Sandbox globals
What a mod script can see. Everything else is not there: reading it gives nil.
Globals
Section titled “Globals”assert error ipairs next pairs pcall xpcall select tonumber tostring type typeof rawequal rawget rawset rawlen setmetatable getmetatable unpack _VERSION, plus mod, print (= mod.log), warn (= mod.warn) and require (your own files only).
Libraries
Section titled “Libraries”Frozen copies: changing string in your mod changes nothing for anyone else.
| Library | Functions |
|---|---|
math |
abs acos asin atan atan2 ceil clamp cos cosh deg e exp floor fmod frexp huge isfinite isinf isnan ldexp lerp log log10 map max min modf nan noise phi pi pow rad round sign sin sinh sqrt sqrt2 tan tanh tau |
string |
byte char find format gmatch gsub len lower match pack packsize rep reverse split sub unpack upper |
table |
clear clone concat create find foreach foreachi freeze getn insert isfrozen maxn move pack remove sort unpack |
utf8 |
char charpattern codepoint codes len offset |
bit32 |
arshift band bnot bor btest bxor byteswap countlz countrz extract lrotate lshift replace rrotate rshift |
buffer |
copy create fill fromstring len readbits readf32 readf64 readi16 readi32 readi8 readstring readu16 readu32 readu8 tostring writebits writef32 writef64 writei16 writei32 writei8 writestring writeu16 writeu32 writeu8 |
math.random and math.randomseed are left out on purpose: use mod.rng(seed), which gives the same numbers on every machine.
Not available
Section titled “Not available”os io debug coroutine loadstring getfenv setfenv _G shared game forge Runtime task script, the engine, the game’s modules, other mods’ files, the file system and the network.
getmetatable returns nil for anything that is not a table. There is no coroutine library: a handler runs on a game thread.