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:

Some controls that are temporarily not supported:

Using Lua

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

  1. Create a new Lua project

Create a Lua project using the command cocos new -l lua GAME-NAME.

  1. 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

Lua project

  1. Click the ... button next to Project Path to select your Lua project directory
  2. Click the Copy Support Library button. (this step only needs to be done once for each new Lua project)
  3. Click the Build button

Automatically build

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.

Run

After the initial build, or after each rebuild, use the cocos run command in your Lua project path to see the scene effect:

Play scene