HomeIndex

Core Functions

clone(table|array)
Returns a shallow clone of the table or array
The clone command will not recurse into the array or table and only clones the top level.
roottable()
Returns the root table
This allows access to all the root (or global) symbols as if it was a table.
These all do the same thing...
text = ::g_name text = roottable()["g_name"] text = roottable().g_name
setdelegate(table, table2)
Sets a delegate for the table for when a key doesn't exist.
After setting a delegate, if a key doesn't exist in table, table2 will be searched.
d = { name = "Name Unknown" } t1 = { name = "Betty" } t2 = { } setdelegate(t1, d) setdelegate(t2, d) print(t1.name) // "Betty" print(t2.name) // "Name Unknown"
It's possible to create circular nested loops of delegates that will lock-up the game, so be careful.
error([value, ...])
Throws an error and prints the string
print([value, ...])
Prints a string or list of values to the debug console.
print("Hi there") print("My score is ", score) print() // just a crlf
sizeof(value)
Returns the size of a string, array or table
For strings it is the number of characters, for an array it's the number of elements and for a table it's the number of keys. All other types return 0.
sizeof() is not utf-8 aware, so when querying a string it will return the number of bytes in the string, which isn't always the number of characters.