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
setstackhidden(funcOrLevel: ((...any) -> ...any) | number, hidden: boolean): ()Parameters
funcOrLevelfunction | numberThe function to change, or a non-negative stack level that picks the function running at that level.
hiddenbooleantrue to hide the function from the stack, false to show it again.
Returns
Nothing.
Note
Example
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