Lua: Datatypes

From Mario Fan Games Galaxy Wiki
Lua
Lua.gif
Basics
Intermediate
Advanced
XLua
Add to this template
 Standardwikimessagebox.png This article assumes the use of Lua 5.1.

Information may not be accurate or may need revision if you are using a different version.

Lua has 8 basic datatypes as of version 5.1: numbers, strings, booleans, tables, functions, threads, userdata, and nil. Like some other scripting languages, Lua is dynamically-typed, meaning only the values have a type, not a variable; therefore, a single variable can have any type assigned to it no matter what type it currently holds.

Because a specific type matters in some situations, the type() function can be used on any variable or data; this function will return a string containing one of "number", "string", "boolean", "table", "function", "thread", "userdata", or "nil" with respect to that datatype.

Further information about specific types can be found on these pages: