Skip to content

debug & misc

The sandbox keeps only the two safe debug functions — no locals access, no hook setting, no VM introspection.

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")) --> whereami

A string traceback of the call stack; message is prefixed if given.

local function inner() print(debug.traceback("here")) end
local function outer() inner() end
outer()
-- here
-- stack traceback:
-- init.luau:1: in function 'inner'
-- init.luau:2: in function 'outer'
-- ...

Compiles a string into a function at runtime, under the same sandbox restrictions as the mod itself. Returns the function, or nil + error.

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:1

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 loaders

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-backed

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