Lua is a dynamic language that has no type-defined syntax in the language.
There are 8 basic types in Lua:
1.nil (empty)
2.boolean
3.number (digital)
4.string (String)
5.userdata (custom type)
6.function (function)
7.thread (thread)
8.table (table)
The function type can return the name of a type based on a value.
Print (type("HelloWorld"------------->string
Since there are no predefined types of variables,
Ten ; Print (type--------------------->numberprint; -- ----------------------> Note This is legal. Print (type----------------------->function
Here we focus on the string type.
LUA strings are immutable values, and if modified can only create a new string:
" One " string.gsub(A,"One","One"); Print (a); -- ------------>one Print (b); -- ------------>two
LUA's strings, like other Lua objects, are objects managed by the automatic memory management mechanism.
You can also use a pair of matching brackets to define an alphabetic string so that you can extend multiple lines, but Lua does not interpret the escape characters.
Such as:
[[]] write (page);
LUA provides run-time numeric and string auto-conversions.
Print ("+"+1------------------>21print(" Hello"+2); -- --------------> Errors
In contrast, LUA can also convert a string into a number
Print (a); -- ---------------->1020
In Lua: Represents a string connection operator.
Types and values of LUA learning