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:
- Standard libraries: Standard libraries
task,wait,spawn,delay,tick,time: Schedulermc: MinecraftModules: ModulesDrawing,Render3D,Camera,ESP,Notify: DrawingVector2,Vector3,Color3,Colorx: Typesrnet,raknet,netty: Network- File, JSON and crypto functions: Files
hookfunctionand friends: Closuresrconsoleand console functions: Console- Everything else (
stringx,Time,Queue,Promise, ...): Utilities
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.