https://www.runoob.com/lua/lua-functions.html
Comment
Single line–
Multiple lines
–[[
]]
Basic type
nil
This is the simplest, only the value nil belongs to this class, which means an invalid value (equivalent to false in the conditional expression).
boolean
Contains two values: false and true.
number
Represents a double-precision real floating-point number
string
The string is represented by a pair of double quotation marks or single quotation marks
You can also use 2 square brackets “[[]]” to represent “a piece of string”.
Example
html = [[
Novice tutorial
]]
print(html)
Use # To calculate the length of the string, put it in front of the string, as in the following example:
> print(#len)
14
> print(#”www.runoob.com”)
14
>
function
< p>Functions written in C or Lua
userdata
Any C data structure stored in a variable
thread
Independent line of execution, used to execute cooperative programs
table
The table in Lua is actually an “associative array” (associative arrays), and the index of the array can be a number , String or table type. In Lua, the creation of a table is done through a “construction expression”. The simplest construction expression is {}, which is used to create an empty table.
print(type(“Hello world”)) –> string
print(type(10.4*3)) –> number
print(type(print)) –> function
print(type(type)) –> function
print(type(true)) –> boolean
print(type(nil)) print(type() nil
print(type( type(X))) –> string
nil Double quotes should be added when comparing “:> type(X)nil> type(X)==nilfalse> type(X)==” nil”true>type(X)==nil is false because type(type(X))==string.
> print(#len)
14
> print(#”www.runoob.com”)
14
>
p>
> len = “www.runoob.com”
> print(#len)
14
> print(#”www.runoob.com”)
14
>