I plan to learn quick cocos2dx recently, so I plan to learn about the Lua language first. Lua is a small script language that is lightweight and easy to expand.
The basic data types of Lua scripts include nil, Boolean, number, String, userdata, function, thread, and table. Table is a special data structure in Lua, some are like struct in C ++ and some are like class.
The NIL type indicates a null value, indicating nothing.
Lua variables are classified into global variables and local variables. Local variables are defined as local variables. If local variables are not defined, they represent global variables.
Lua Function Definition: defines a function with the keyword "function" and ends with the keyword "end". For example, function add (a, B) Local sum = a + BReturn sum end.
Lua table definition: A ={}, B = {2, 4, 5}, c = {A = 32}, traverse the Lua table, for K, V in pairs (c) do print (K, v) End
Lua learning-1