debug & misc
The sandbox keeps only the two safe debug functions — no locals access,
no hook setting, no VM introspection.
debug.info(target, options)
Section titled “debug.info(target, options)”Inspects a function or stack level. target is either a function or a
stack level (1 = the caller of debug.info). options is a string of
specifiers; the function returns one value per specifier.
| Option | Returns |
|---|---|
s |
source string |
l |
current line |
n |
function name |
f |
the function itself |
a |
number of arguments (vararg functions report -1) |
local function whereami() end
local source, line = debug.info(1, "sl")print(source, line) --> e.g. init.luau 5
print(debug.info(whereami, "n")) --> whereamidebug.traceback(message?, level?)
Section titled “debug.traceback(message?, level?)”A string traceback of the call stack; message is prefixed if given.
local function inner() print(debug.traceback("here")) endlocal function outer() inner() endouter()-- here-- stack traceback:-- init.luau:1: in function 'inner'-- init.luau:2: in function 'outer'-- ...loadstring
Section titled “loadstring”Compiles a string into a function at runtime, under the same sandbox
restrictions as the mod itself. Returns the function, or nil + error.
loadstring(chunk, chunkname?)
Section titled “loadstring(chunk, chunkname?)”local f = loadstring("return 6 * 7")print(f()) --> 42
local bad, err = loadstring("return +")print(bad, err) --> nil Unexpected symbol near '+'Chunk names appear in error tracebacks — use the @-prefixed convention
for clarity:
local f = loadstring("return 1/0", "@generated/rules.luau")-- any error later reports as: generated/rules.luau:1require
Section titled “require”The global exists, but no module loaders are configured: every call
errors (require path must start with a valid prefix: ./, ../, or @).
One entry script per mod for now; package-local require is planned.
require("./lib") -- error: requiring module "./lib": ... no loadersprint (the overridden global)
Section titled “print (the overridden global)”See print in the Functions reference — PoZoUSEMS
replaces the stock print with one that writes to the Source console, the
live console, and the log file, prefixed with your mod id.
print("vanilla-looking, USEMS-backed")-- [my-mod] vanilla-looking, USEMS-backedVerified absent
Section titled “Verified absent”Everything below is confirmed absent at runtime (from the same inventory test that produced these pages) — not just undocumented:
| Global | Notes |
|---|---|
io |
the entire library — no file access |
package |
module system removed |
load |
use loadstring instead |
os.execute / os.getenv / os.remove / os.rename / os.exit / os.tmpname |
no process, env, or FS reach |
debug.getlocal / debug.sethook / … |
only info and traceback survive |