The existence of any language is to express, as a dynamic configuration, Lua provides us very powerful and very flexible expressions.
Lua is a dynamic type language that only has several basic types: NIL, Boolean, Number, String, UserData, Function, Thread and Table. NIL, Boolean, Number, String These are similar to other languages. Since Lua implements dynamic memory management, there is no need to worry about memory allocation and release problems when using String.
In Lua, Function is a value, which can be stored in one variable, which can be used as a parameter of another function, and can be returned as the return value.
UserData expresses a original memory area that can be stored in a variable, and there is no predefined operation for UserData in Lua, in addition to assignment and equivalent testing. UserData cannot create and modify in Lua, which can only be operated by C API. UserData performs a handle concept, you can hold it in Lua, you can hand it to any C CPI to operate it, but you cannot change it in Lua.
Thread represents a thread that is independent, is used to implement COROUTINES.
Table is the only data structure in Lua, which provides us with extraordinary expression, in Lua, you can use table to express an Array, Dynamic Array, List, Set, Queue, Map, etc., all of this can Use table to express in a simple way.
In Lua, Table is neither a value, nor a variable, in fact, it is an object in Lua, we can't declare a table, can only create a table with Table constructor:
A = {}
In Lua, Table will always be anonymous. In the above statement, we created a table, then let the variable A reference to this table, which means that in a reference to a Table variable and the Table itself A fixed relationship. As you can see from the following example:
A = {}
A.name = "lua"
B = a
A = NIL
Print (B.Name)
The program will output "Lua" instead of NIL
When the program no longer uses a table, the Lua Memory Manager will automatically release its memory.