Introduction to Cocos2d-x scripting language Lua

Source: Internet
Author: User

Introduction to Cocos2d-x scripting language Lua

This blog record Lua learning, learning from the eoe Forum, Lua language development Cocos2d-x game getting started video tutorial, the following URL:

Http://www.eoeandroid.com/thread-320602-1-1.html

Because Lua is compact, simple, and seamlessly integrated with C/C ++, runs fast, and is easy to update, more and more companies are using Lua for game development, the recruitment requirements of many Cocos2d-x engineers directly stated that the requirements will be Lua language. I learned that when a company was developing a Cocos2d-x game, the game logic was fully developed in Lua, the reason is that, after going online, if you find a Bug, you don't need to update the shell program, you just need to load and replace a Lua file or Lua bytecode file, especially on the iOS platform, there is no need to submit new programs to Apple for a review process, so Lua language is very useful. This is why I want to record this tutorial.

L01Lua
Http://www.eoeandroid.com/thread-320717-1-1.html
L0201 basic syntax
Http://www.eoeandroid.com/thread-320720-1-1.html
L0202 table
Http://www.eoeandroid.com/thread-320723-1-1.html
L0203 Array
Http://www.eoeandroid.com/thread-320725-1-1.html
L0301 table Copying Method object-oriented
Http://www.eoeandroid.com/thread-320729-1-1.html
L0302 function closure method object-oriented
Http://www.eoeandroid.com/thread-320732-1-1.html
L0401 use Lua language in Cocos2d-x
Http://www.eoeandroid.com/thread-320733-1-1.html
L0402Lua game example
Http://www.eoeandroid.com/thread-320751-1-1.html

Here, I would like to thank the violin/wx for your explanation.

The little witch here to show the Buddha, the entire Lua video tutorial learning recorded, to learn with everyone to learn how to use Lua in the development of the game in Cocos2d-x.


The above ime teacher has already talked about Lua's language features. I will not talk much about it here. Let's start with the first lesson to introduce Lua.

To Lua's official website: http://www.lua.org


Download Our Lua:



Here I download the latest version of lua-5.2.3

Extract the following directory files:


In mac systems, you can directly use the make command to compile Lua:

Use the terminal to enter the Lua Directory: Run make macosx to compile Lua.


After compilation, the corresponding. o file is generated in the src directory:


Two executable files are generated: lua and luac.


Enter the command line and execute./lua


Run the sudo nano hello. lua command to create a new Lua file.


After saving the file, the hello. lua file is generated and executed on the command line:


In this way, we can execute the lua code through the lua command.

Similarly, we can use the luac command to generate a bytecode file for the hello. lua file.

Run./luac hello. lua to generate a luac. out bytecode file.

Then we use./lua luac. out to implement the same effect as executing the source file using the lua command:



The above is the introduction to Lua. The next blog introduces the basic syntax of Lua.

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: info-contact@alibabacloud.com 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.