FANDOM


ValuesEdit

EssentialsEdit

There are eight different types of values in Lua. These are boolean, function, nil, number, string, table, thread, and userdata. For specific information on each, please click the links below.

SamplesEdit

Sample
The following demonstrates that foo is of type string.

Source:

local foo = 'bar'
print(type(foo))
Output:

string


ExtraEdit

Once written, Lua doesn't automatically parse values. In order for Lua to parse the value immediately, you must wrap the value in parethesis.

Pitfall
Demonstrates Lua's value parsing behavior.

Wrong:

print({'Hello', 'World'}[1])
Right:

print(({'Hello', 'World'})[1])