Global Environment

SmartThings Lua scripts execute in an environment similar to the stock Lua environment. Some functions have been removed where they are impossible to use from within the sandbox, such as those dealing with filesystem access. Some have been reimplemented, matching the behavior of the standard lua implementation to work with the sandbox, such as require.

There is no functionality added to the global environment. All SmartThings specific functionality is provided in the form of libraries accessible via require.

class coroutine

See Lua Reference Manual: https://www.lua.org/manual/5.3/manual.html#6.2

assert()

See Lua Reference Manual: https://www.lua.org/manual/5.3/manual.html#pdf-assert

collectgarbage()

See Lua Reference Manual: https://www.lua.org/manual/5.3/manual.html#pdf-collectgarbage

error()

See Lua Reference Manual: https://www.lua.org/manual/5.3/manual.html#pdf-error

getmetatable()

See Lua Reference Manual: https://www.lua.org/manual/5.3/manual.html#pdf-getmetatable

ipairs()

See Lua Reference Manual: https://www.lua.org/manual/5.3/manual.html#pdf-ipairs

next()

See Lua Reference Manual: https://www.lua.org/manual/5.3/manual.html#pdf-next

pairs()

See Lua Reference Manual: https://www.lua.org/manual/5.3/manual.html#pdf-pairs

pcall()

See Lua Reference Manual: https://www.lua.org/manual/5.3/manual.html#pdf-pcall

rawequal()

See Lua Reference Manual: https://www.lua.org/manual/5.3/manual.html#pdf-rawequal

rawget()

See Lua Reference Manual: https://www.lua.org/manual/5.3/manual.html#pdf-rawget

rawlen()

See Lua Reference Manual: https://www.lua.org/manual/5.3/manual.html#pdf-rawlen

rawset()

See Lua Reference Manual: https://www.lua.org/manual/5.3/manual.html#pdf-rawset

require()

See Lua Reference Manual: https://www.lua.org/manual/5.3/manual.html#pdf-require

setmetatable()

See Lua Reference Manual: https://www.lua.org/manual/5.3/manual.html#pdf-setmetatable

select()

See Lua Reference Manual: https://www.lua.org/manual/5.3/manual.html#pdf-select

tonumber()

See Lua Reference Manual: https://www.lua.org/manual/5.3/manual.html#pdf-tonumber

tostring()

See Lua Reference Manual: https://www.lua.org/manual/5.3/manual.html#pdf-tostring

type()

See Lua Reference Manual: https://www.lua.org/manual/5.3/manual.html#pdf-type

xpcall()

See Lua Reference Manual: https://www.lua.org/manual/5.3/manual.html#pdf-xpcall

class math

See Lua Reference Manual: https://www.lua.org/manual/5.3/manual.html#6.7

os.clock()

See Lua Reference Manual: https://www.lua.org/manual/5.3/manual.html#pdf-os.clock

os.date()

See Lua Reference Manual: https://www.lua.org/manual/5.3/manual.html#pdf-os.date

os.difftime()

See Lua Reference Manual: https://www.lua.org/manual/5.3/manual.html#pdf-os.difftime

os.time()

See Lua Reference Manual: https://www.lua.org/manual/5.3/manual.html#pdf-os.time

class string

See Lua Reference Manual: https://www.lua.org/manual/5.3/manual.html#6.4

class table

See Lua Reference Manual: https://www.lua.org/manual/5.3/manual.html#6.6

class utf8

See Lua Reference Manual: https://www.lua.org/manual/5.3/manual.html#6.5