In Lua, variables are values that allow scripts to store information in memory. There are eight basic types of variables in Lua, and the eight basic types are nil, number, string, boolean, table, function, userdata, and thread.

To assign a value to a variable, use the syntax "variable = 10".


The nil variable is the default variable type, which all unassigned variables take the form of.


The number variable is what the name suggests, a floating point number of any value, and can be of a negative or positive value.


The string variable is a string of letters, and can contain most characters you can type. To create a string, wrap text in double quotes ("") or single quotes (''), or within brackets ([[]]) if you want a multi-line string.


The boolean variable takes the form of either a true or false value, with true being on, and false being off. If a Boolean is not false then it must be true, and if it is not true then it must be false. The not operator can be used before a boolean value to invert it (so "not false" is equal to true and "not true" is equal to false).


Main article: Table

In Lua, the table variable is a general-purpose aggregate datatype that can store multiple variables (including additional tables). To create a table, use a matching pair of curly brackets ({}).


Main article: Function

In Lua, the function variable is a variable that when called, will run the same piece of code from multiple places, without having to duplicate the code in multiple places.

To create a function, use the function keyword (for example, newFunction = function() print(newFunction) end).



Ad blocker interference detected!

Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.