< Operators | UserGuide | Nil >


Variables are values that are used to store information. I.e.
 x = 5
will tell Lua, that a global variable named 'x' should store a numbervalue that is 5. The equal sign will create or overwrite that value that was associated with 'x' before.

Variables in Lua donnot have to be declared and donnot need a type. The type is determined by the value and can be changed whenever a new value is assigned to the variable.


Lua has only a few data values:
NilNil is a special value. Assigning nil to a variable will tell Lua that the variable itself is nolonger used
BooleanBoolean values are describing either true or false values.
NumbersThere is no difference between fixed point and floating point numbers such as in other languages
StringsStrings are binary, which means that a string can contain all character values from 0-255.
TablesTables can associate values with values. I.e. the string value "x" can be associated with the number value 5 - which is just the same as the first example showed. In Lua, everything is stored in tables. The value "x" is here the key, the number 5 is the value. The key and the value in a table can be of any type
FunctionsA function is a variabletype too. Functions can be declared anywhere in Lua and are stored in the same way as other valuetypes are.
CoroutinesCoroutines are functions that can decide to pause at any time of their execution and that can be continued later. This is somewhat similiar to threads, except that the programmer decides when the function execution should be yielded
UservalueA uservalue is a value, that is used by the host of Lua, which is Luxinia in our case. Any special value in Luxinia such as a particlesystem or a model are represented as uservalues in lua. Uservalues cannot be modified in Lua itself.

These are all the types used in Lua. Tables and functions are the most useful and most used types in Lua.