Hello, I’ve searched for this information but could not found any. I know that phonegap/cordova uses a webview to do cross-platform support and Xamarin uses mono. But how Corona does it cross-platform support?
Corona uses a language called Lua which is available more many different platforms. On top of that we use OpenGL a technology available almost everywhere to perform our screen updates. Then we have a native layer on top to make it all work on the various platforms that we support.
Our build process has been programmed to output .APK’s for Android, .EXE’s for Windows, .app’s for macOS and iOS and so on.
Rob
Thanks Rob, so the code we write in Lua is somewhow “transpiled” to Java for Android and Object-c for iOS, to generate the binaries?
Lua isn’t transcoded to other languages. Instead a Lua runtime processes the Lua bytecode and makes calls to native code to do the work. (this is a generalization), the display.newImageRect() function will make a call thru Lua’s runtime bridge to code, written in C++ (other things could be in Objective C or Java) that calls the statements to generate a texture object from the passed file name. The texture gets passed back to the Lua side so you can manipulate it.
Rob
Rob, so every plataform Corona supports has natively a Lua VM/Interpreter or it is shipped with our application? Is there any documentation for this Lua’s runtime so I can see how it does the cross-thing?
The lua engine is built in to each app you build. There might be some information in our Corona Enterprise documentation that could be helpful.
https://docs.coronalabs.com/native/index.html
Rob
Corona uses a language called Lua which is available more many different platforms. On top of that we use OpenGL a technology available almost everywhere to perform our screen updates. Then we have a native layer on top to make it all work on the various platforms that we support.
Our build process has been programmed to output .APK’s for Android, .EXE’s for Windows, .app’s for macOS and iOS and so on.
Rob
Thanks Rob, so the code we write in Lua is somewhow “transpiled” to Java for Android and Object-c for iOS, to generate the binaries?
Lua isn’t transcoded to other languages. Instead a Lua runtime processes the Lua bytecode and makes calls to native code to do the work. (this is a generalization), the display.newImageRect() function will make a call thru Lua’s runtime bridge to code, written in C++ (other things could be in Objective C or Java) that calls the statements to generate a texture object from the passed file name. The texture gets passed back to the Lua side so you can manipulate it.
Rob
Rob, so every plataform Corona supports has natively a Lua VM/Interpreter or it is shipped with our application? Is there any documentation for this Lua’s runtime so I can see how it does the cross-thing?
The lua engine is built in to each app you build. There might be some information in our Corona Enterprise documentation that could be helpful.
https://docs.coronalabs.com/native/index.html
Rob