AcediaDocumentation

debug.getcallstack

Lists metadata rows for visible caller stack frames.

Each row contains source, name, what, currentline and func. what is "Lua" or "C", currentline is the line the frame is executing, and func is the frame's closure. Visits at most 31 levels and skips hidden ones.

debug.getcallstack(): {table}

Example

local function inner()
    for _, frame in debug.getcallstack() do
        print(frame.what, frame.currentline, type(frame.func))
    end
end
inner()

Each line prints Lua, the line that frame is on, and function.

On this page