Value Types
Lua variables can contain one type of value.
Data Type | Description | Example |
|---|---|---|
nil | A value with no data (null not 0). A variable without an assigned value is nil by default. | local x
local x = nil |
boolean | Either true or false. | local x = true |
number | Any number, including fractional or negative numbers. | local x = 103.9 |
string | A string of text or characters. See https://interfaceware.atlassian.net/wiki/spaces/IXB/pages/3128786945 | local x = "This is a string"
local x = [[
This is a
longer string]] -- multiline |
table | See https://interfaceware.atlassian.net/wiki/spaces/IXB/pages/2684780567. | local x = {1,2,3,4} |
function | See https://interfaceware.atlassian.net/wiki/spaces/IXB/pages/2685304936. | function hello()
trace('hello world')
end |
userdata | See https://interfaceware.atlassian.net/wiki/spaces/IXB/pages/2684454460 |
|
In the Translator, you can use type() to see the variable value:
local name = Tracy
type(name) -- will display string