🌐Global Functions

Below is a list of all global functions. By “global”, we mean these functions do not require a preceding namespace - so you can call them directly, unlike other functions.

print

Function

Prints text to game's console. Automatically inserts a space between parameters.

Arguments

Name
Type
Description

...

...

Values to print in the console.

Example

print('Hello world!', 123); -- prints out "Hello world! 123" to the console

error

Function

Prints an error text to game's console, and shuts down the script. Try to avoid using this function - use it only if an error happens which you can't recover from.

Arguments

Name
Type
Description

text

string

Read print for documentation.

Example


unpack

Function

Unpacks a table of elements.

Arguments

Name
Type
Description

tbl

table

Any table

Example


Delay

Function

Delays a callback by a certain amount of time, in seconds.

Arguments

Name
Type
Description

delay

number

Delay, in seconds

callback

function

Callback

Example


__shutdown

Function

Special function, it's called whenever the script unloads. Isn't called in case of errors.

Arguments

None.

Example

Last updated