Lua Engine Support

Cocos Creator developers that use Lua can build scenes and UI, and use Lua script to control nodes and UIs in game.

Main features

Currently supported features:

Instructions for use

There are three steps needed to use scenes created by Cocos Creator in Lua project. This will be further streamlined in coming versions.

Setup

  1. First you need to download the latest version of the Creator-Lua template project.

    Or you can pull from GitHub:

    sh $ git clone https://github.com/dualface/creator-lua.git

    For the rest of this document we refer to this as PATH-TO-CREATOR-LUA.

  2. Create a new project Lua: sh cocos new -l lua GAME-NAME

  3. Remove Lua Project src andres directory of all files.

  4. Copy the PATH-TO-CREATOR-LUA/lua-project/src files and all subdirectories in the directory to src Lua project.

  5. Copy the PATH-TO-CREATOR-LUA /lua-project/convert-creator-build.sh and PATH-TO-CREATOR-LUA /lua-project/convert-creator-build.bat project file to the Lua directory.

Building A Scene

  1. In Cocos Creator, save the edited scenes, and then select the menu Project -> Build publish.
  2. Publish the platform of choice for the Lua

    Build

  3. Click the Build button

After completion the publishing path will contain all the scenes and their resources. These resources can not be used in a Lua project without being converted.

Converting to Lua format

  1. From the command-line goto the Lua project directory.
  2. If you are on OSX or Linux, run ./convert-creator-build.sh ../creator-project/build/lua. If you are on Windows, run convert-creator-build.bat .. \creator-project\build\lua.
  3. You will see done if everything converts successfully.

After the conversion is complete, open the operation of the project (or use cocos run command), you can see the effect of the scene:

Play scene

Precautions

After every change made to the Scene you need to do build -> Convert operation.