Game Development Reference
In-Depth Information
Lua primitives
Lua has 8 basic primitives: nil, Boolean, number, string, function, userdata, thread, and
table:
•
Nil
: Here, a value corresponds to a null value in C.
•
Boolean
: Here, values are equivalent to their C++ counterparts and represent either
true or false.
•
Number
: This internally represent doubles that Lua uses to store integers, longs,
floats, and doubles.
•
String
: This represents any sequence of characters.
•
Function
: Lua also considers functions as a primitive, which allows you to assign
functions to variables.
•
Userdata
: This a special Lua type that maps a Lua variable to data managed by the
C code.
•
Thread
: A thread primitive is used by Lua to implement coroutines.
•
Table
: This is an associative array that maps an index to a Lua primitive. A Lua
table can be indexed by any Lua primitive.