Lua engine support
Lua developers can use Cocos Creator to build Scenes and UI's for Lua games in the normal display and operation.
The currently supported functions are as follows:
- Sprite - Sprite: Image display
- Canvas - Canvas: mainly used for automatic layout
- Widget - Widgets: You can set up automatic layouts and various alignments with Canvas
- Button - Button: Responds to player action
- EditBox - edit box: used for players to enter text
- ParticleSystem - Displays particle effects
- TileMap - Map: Displays a map edited using Tiled
- Animation - Animation only supports frame animation
- Label (System Font) - Text label: only supports system fonts
- Component with Lifetime events - components and their life cycle management
Some controls that are temporarily not supported:
Starting with Cocos Creator v1.3, Lua Engineering support will be added as a plugin to Creator. First, you will need to download the Creator-for-Lua plug-in and execute the installer:
Build the project for the first time
- Create a new Lua project
Create a Lua project using the command
cocos new -l lua GAME-NAME.
- Set up your scene in the Creator. Next, from the main menu, select Project -> Lua Support -> Setup Target Project, open the Lua project settings interface
- Click the ... button next to Project Path to select your Lua project directory
- Click the Copy Support Library button. (this step only needs to be done once for each new Lua project)
- Click the Build button
By default, the automatic build feature is not enabled. To update the Lua code after modifying the scene, you need to click the Build button again, or select the project -> Lua Support -> Build Now.
The easiest way to do this is to select the Auto Build option in the dialog box. So every time you save the scene, it will automatically update the Lua code friends.
After the initial build, or after each rebuild, use the
cocos run command in your Lua project path to see
the scene effect: