Today we introduced the new favorite of mobile development: Lua language. The Lua Code mentioned in this article can be compiled and run on almost all operating systems and mobile terminals, we have introduced the Wax framework developed by Lua on iOS. This document introducesCorona,CoronaLater, the Lua language will support iOS and Android platforms. This article is helpful if you are using or intend to use Corona SDK.
First, the advantages of Corona SDK:
◆ Stable
◆ Support for hardware acceleration, GPS, compass, and cameras
◆ Support integration with Map, Facebook, OpenFient, and GameCenter
◆ Built-in physical integration
◆ Lua language is easier to learn
◆ There are already some very good applications, at least to prove that this SDK can make excellent applications
◆ Good Community Support
Then there is something wrong with the Corona SDK.:
◆ Only supports iOS and Android
◆ The Lua language is not object-oriented
◆ An annual license fee is required.
◆ There are too many bugs in Android support
There are other supplementsFor example:
◆ Third-party sdks not supported by Corona SDK cannot be integrated by themselves
◆ When compiling a project, you need to upload the code to the Corona server for compilation. You cannot directly compile the code locally.
◆ Corona functions cannot be expanded, but official updates are too slow. This is the most reflected problem.
◆ Some defects exist in the physical module
Relatively speaking, the new Monkey SDK has greatly improved these defects, such as wider platform support, for example, convenient Native Code integration. For example, you only need to purchase one authorization, for example, the fully object-oriented Bliz scripting language. The following describes how to develop Android or iPhone client applications in the Lua + Corcna SDK library.
1. Selection of development languages
IPhone has Objective-C
Android uses many Java
However, you can look at the ranking of programming languages. Lua, a Brazilian language invented specifically for Embedded Development, is now widely used. It has ranked the top 10, while Ruby ranks around 11.
Ii. SDK library selection
In fact, the key to why Lua is so good is the emergence of an SDK library, just as the emergence of Rails activates Ruby. The emergence of this SDK library activates Lua.
It is the same name as the beer-corola we used to point in the bar: Corcna.
Corcna also contains a mobile phone simulation environment used on a PC.
Now, download and install the Lua development environment and the Corcna SDK library.
After the Lua + Corcna environment is ready, you can write it at a time and place the application on the iPhone or Android.
Speed? It is said there is no problem.
3. Create the first hello program
In fact, the SDK provides library functions for various environments.
Corcna is a mobile-based library function (I guess it includes Android and iPhone. After compilation, You can intelligently use the corresponding library function. )
Use any editor. notepad ++ has Lua syntax to identify Lua code. Enter the following code:
- local textObject = display.newText( "Hello World!", 50, 150, native.systemFont, 24 )
-
- textObject:setTextColor( 255,255,255 )
Save as: main. Lua, main is the entry.
Now, we can use the Corcna simulator to run this code. Open, main. Lua. At this time, hello world is displayed on the simulated mobile phone screen.