Lua It is a small script language that can be parsed directly by parser. The purpose of the design is to embed the application program, so as to provide flexible expansion and customization functions for application.
Lua Written by standard C, it can be compiled and run on almost all operating systems and platforms.
LuaThere is no strong library, so Lua is not suitable for developing stand-alone application languages.
Lua There is a simultaneous JIT project that provides timely compilation functions on specific platforms.
Lua Not only can it be called as an extension script by other code, but also as a common configuration file, instead of XML, ini and other file formats, and easier to understand and maintain. In all the current scripting engines,
LuaThe speed is the fastest, all of which decide that Lua is the best choice for embedded script.
LuaDevelopment environment:LuaforWindows（Include Lua parsers, help documents, API manuals
1、Single line notes: –
LuaThere can be no “end” after the language; it can also input multiple rows on the same line.
LuaThe data type in it:
1、nil 2、 Boolean 3、 number 4、string
5、function 6、table 7、thread 8、userdata
Input in edit code area: Print (“Hello world”).
Clicking the run button (Upper Red position) will output Hello world below and succeed.
LuaVariable: 1,LuaIn addition to keyword, all other variables are variables, and can not be used before variables are created.
2、Variables used in the definition are underlined, underlined, and numeral sequences.
3、It is best not to use underscores and uppercase identifiers. The underline and uppercase letter are reserved for the system and cannot be defined.
4、LuaThere are three types of intermediate variables: global variables, local variables, and fields in the table.
LuaThe variables in the system are global variables. Even in functions, if you want to define local variables, add local before variables, and the default values of variables are nil.
5、LuaBasic data types:
（1）nil：LuaA special value in the form of a null value. All variables that are not assigned are nil. Nil is a numeric value and a type. Assigning nil to global variables can delete this variable.
（2）Logical value: there are only two kinds of two true and false, and all other values are true except for false and nil.
（3）Value: equivalent to the double type in C#, which can replace integer, floating point number.
（4）String: consists of numbers, letters, and underscores.
There are three forms of representation: （1）Single quotation marks: ”
（2）Double quotes: “”
（3） Double brackets []
The way of separation:
1、When the numbers are entered, they are directly separated by “,”
2、When you enter a string, you can use the join string.
The conversion of a string:When running Lua, when strings use arithmetic operators, type conversion is automatically done between String and numbers.
String common methods:
（5）Function: function itself is a variable that can be used as a function or as a return value, ending with end.
This is an example of the function of printing HelloWorld
1、table It is a data structure of Lua to help us create different data types, such as arrays, dictionaries and so on.
2、Lua table Using an associative array,
3、You can use any type of value to index an array, but this value can not be nil.
4、Lua table It is not fixed size, you can expand according to your needs.
5、LuaIt is also through table to solve modules (module), packages (package) and objects (Object).
1、userdataSpecialize in dealing with Lua host.
2、userdata The C data can be stored in the Lua variable.
3、userdata In Lua, there is no predefined operation except assignment and equality comparison.
4、userdata A new type that is used to describe an application or a library created by C.
For example, a file is described with a standard I/O library.