Overview

The environment

What globals exist, what is removed, and what _G, shared and getgenv mean.

Scripts run in a custom global environment (genv). Everything a script can see is built when the script is launched.

Base globals

These are available exactly as in Luau:

assert, error, getmetatable, ipairs, next, pairs, pcall, xpcall, rawequal, rawget, rawlen, rawset, select, setmetatable, tonumber, tostring, type, typeof, unpack (same as table.unpack).

Changed or restricted globals

print(...)

Joins its arguments with tabs and writes one line to the in-game console at the normal level.

warn(...)

Same, at the warning level.

collectgarbage(opt)

Only "count" (or no argument) does anything and returns the memory in use in KB. Any other option returns 0 and does nothing.

getfenv() and setfenv()

Disabled. Calling either raises the error getfenv is disabled for this env (or setfenv ...).

_VERSION

A string such as Luau (Agnes Tachyon Lua API <version>).

Environment tables

_G

The script environment itself. _G.x = 1 creates a global x.

shared

An empty table that is yours to use for sharing values between parts of a script.

getgenv()

Returns the same environment table as _G. See Closures.

getrenv()

Returns a frozen copy of the base globals listed above.

Everything else

The rest of the environment is documented in the other categories:

Frozen libraries

Most library tables (mc, Drawing, Modules, stringx, ...) are frozen. You cannot add or change fields on them. Use hookfunction to replace a function, or copy the table with tablex.clone.