Lua: Datatypes

From Mario Fan Games Galaxy Wiki
Revision as of 16:34, 26 September 2009 by Xgoff (talk | contribs) (Created page with '{{Lua}} Lua has 8 basic datatypes as of version {{Lua_Version|nominor=}}: ''numbers'', ''strings'', ''booleans'', ''tables'', ''functions'', ''threads'', ''userdata'', and ''…')
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
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: