Skip to content
Debug libraryOverview

debug.getstack

Represents inspection of stack-frame values.

Aliasesgetstack

Details#

Reads register values from an active Luau stack frame. Supply a level and optionally a one-based register index; without the index it returns a table. Registers are compiler-assigned slots, not stable local-variable names.

Examples#

Example

Luau
local function inspect()
    local marker = { value = 42 }
    local ok, values = pcall(debug.getstack, 1)
    if ok then for i, value in pairs(values) do print(i, value) end end
    return marker
end
inspect()