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.lua
To 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: http://blog.csdn.net/zhoumushui