Skip to content
Saiko

setstackhidden

Controls whether a function appears in stack traces and debug info. A hidden function is skipped when the stack is inspected, so it does not show up in debug.traceback.

Signature

luau
setstackhidden(funcOrLevel: ((...any) -> ...any) | number, hidden: boolean): ()

Parameters

funcOrLevelfunction | number

The function to change, or a non-negative stack level that picks the function running at that level.

hiddenboolean

true to hide the function from the stack, false to show it again.

Returns

Nothing.

Note

Example

luau
local function hook()
    return debug.traceback("inside the hook")
end

print(hook()) --> the trace lists hook

setstackhidden(hook, true)
print(hook()) --> the trace no longer lists hook