Debug
Stack frames, constants, upvalues, and debug information.
Functions
debug.getcallstackCapture visible Luau frames from a coroutine. Use it to print a compact stack trace with function references and current line numbers.
debug.getconstantRead one constant stored in a Luau function’s compiled prototype. Use it when inspecting the literal values a function was compiled with.
debug.getconstantsRead all constant slots from a Luau function at once. It is useful when exploring a compiled function without guessing which slot contains a literal.
debug.getinfoGet a structured description of a function, stack frame, or ProtoProxy. Use it to see source, line, parameter, and upvalue information in one call.
debug.getprotoGet one nested Luau prototype from a function. Use the default ProtoProxy for metadata or prototype hooks; request active closures when you need actual live functions.
debug.getprotosList the immediate nested prototypes compiled inside a Luau function. This helps you locate a child function before asking for its metadata or installing a proto hook.
debug.getsafeenvRead the safe-environment flag of a Luau environment table. It helps diagnose whether a function or coroutine is running with an environment marked safe.
debug.getstackRead the register values of a visible Luau stack frame. It helps diagnose an active call when you need its current values, not just the function’s compiled metadata.
debug.getupvalueRead the value captured in one upvalue slot of a Luau function. It is useful for checking the state a closure carries without calling it.
debug.getupvaluesInspect all captured upvalue slots of a Luau function. Use it to see which outside values a closure currently depends on.
debug.setconstantReplace one literal slot in a Luau prototype. This changes code that uses the slot, so save the old value if the edit should be temporary.
debug.setinfoUpdate the supported debug metadata of a Luau function or frame. It is useful for giving a generated function a clearer name or source label in later diagnostics.
debug.setprotoReplace one nested prototype reference in a Luau function. It affects closures created from that nested slot after the change, so retain a matching original closure if you plan to restore it.
debug.setsafeenvSet the safe-environment flag on an environment table. This affects environment handling, so use a table you own and preserve its earlier flag if you need to restore it.
debug.setstackWrite one register in a visible Luau stack frame. It is a low-level tool for changing an active call’s state; inspect the slot first and restore it if you only need a temporary probe.
debug.setupvalueReplace one value captured by a Luau closure. This lets you change a closure’s state without rebuilding it.
debug.setupvaluenameChange the debug name stored for one upvalue slot. This only changes metadata, which can make inspected closures easier to understand.
debug.validlevelCheck whether a stack level exists before inspecting it. This is useful in tracing code where callers may have different depths.
isstackhiddenCheck whether a function is explicitly marked as hidden from stack inspection. This helps confirm a temporary stack-visibility change was cleared.
setnameGive a Luau function a more useful debug name. It is a small convenience wrapper around debug.setinfo for naming generated callbacks.
setstackhiddenMark a function’s frames as hidden from Kawaii’s visible stack inspection. Use it to keep a helper frame out of diagnostic call stacks, and clear the flag when finished.