debug.setstack Synchronous

  • setstack

Write 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.

Syntax
Luau
debug.setstack(level: number, index: number, value: any) -> ()

Parameters

Function parameters
ParameterTypeDescription
levelnumberVisible stack level to modify.
indexnumberOne-based register slot.
valueanyValue written into the slot.

Returns

()

No value.

Usage notes

The same numeric slot can mean something different in another call frame.

Example

Example
Luau
local function inspect()
    local old = debug.getstack(1, 1)
    debug.setstack(1, 1, old) -- A harmless round trip of one slot
end
inspect()
Kawaii documentation