Quirrel4.41.0

getconsttable

Global, available without an import
getconsttable(): table

Returns the const table.

Return value

The const table: a table holding engine-defined constants, such as SQOBJ_FLAG_IMMUTABLE (the flag getobjflags reports and freeze sets).

Notes

An ordinary, writable table, not itself frozen; nothing stops a script from adding its own slots. A script's own const and enum declarations do not go through it - those are baked into the compiled code directly and never touch this table.

Example

examples/globals/getconsttable.nut
println("getconsttable().SQOBJ_FLAG_IMMUTABLE =", getconsttable().SQOBJ_FLAG_IMMUTABLE)  // an engine-defined constant

getconsttable().MY_CONST <- 123  // the table itself is an ordinary mutable table
println("getconsttable().MY_CONST =", getconsttable().MY_CONST)

println("getconsttable() == getconsttable() =", getconsttable() == getconsttable())  // the same table every call
Output:
getconsttable().SQOBJ_FLAG_IMMUTABLE = 1
getconsttable().MY_CONST = 123
getconsttable() == getconsttable() = true

See also

getroottableReturns the root table.
globalsmodule index