Value Types
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 Strings | local x = "This is a string"
local x = [[
This is a
longer string]] -- multiline |
table | See Lua Tables. | local x = {1,2,3,4} |
function | See Functions. | function hello()
trace('hello world')
end |
userdata | See User data type |
|
In the Translator, you can use type() to see the variable value:
local name = Tracy
type(name) -- will display string
, multiple selections available,