Lua Study Notes for Cocos2d-x game development, cocos2d-xlua

Source: Internet
Author: User

Lua Study Notes for Cocos2d-x game development, cocos2d-xlua

Download link what is Cocos2d-x

  • An open-source mobile 2D game framework released under the MIT license.
  • You can use C ++, Lua, and Javascript for deployment.
  • Cross-platform: iOS, Android, Blackberry, and Tizen.
Applications developed using Cocos

What is Lua?
  • Script Language
  • Compiled by standard C, the code is concise and elegant
Hello, World
// No population function, no semicolon ending print ("Hello, World ")

Language Features: Table

Development Environment Construction

Go to the Lua official website (download> binaries) to download the binary interpretation environment. On the SourceForge page that you are redirected to, click the red line to download:

After decompression:

Write hello. lua, open the command prompt (Shift + right-click) in this folder, and then executelua53.exe hello.luaTo run:

Lua Annotations:

-- I am a comment
Lua value and type
  • Value: 1, 2, 3; 3.14;
  • String: "Hello, World"
  • Boolean: true, false
  • Table (array + ing ):
Table Array a = {} a [1] = 1a [2] = 2a [3] = "lua" print (a [1], a [2], a [3]) is equivalent to: B = {1, 2, "lua ",} table ing c = {} c ["number"] = 1c [3] = falseprint (c. number, c [3]) is equivalent to: c = {["number"] = 1, [3] = false ,}

Lua array starts from 1


Copyright statement: This article is original, reproduced please indicate the source:

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.