ReferenceDebug

debug.getcallstack

Returns metadata for visible Lua call frames.

Syntax

debug.getcallstack(thread: thread?) -> {table}

Also available as

getcallstackget_callstack

Parameters

ParameterTypeDescription
threadthread?Thread to inspect; omit for the current thread.

Returns

TypeDescription
{table}Visible frame records.

Description

Each entry exposes func; Lua frames can also include currentline. A supported thread may be supplied to inspect its stack. C frames do not provide a Lua source line. The result is a snapshot and is not a way to resume or modify a thread.

Example

for index, frame in debug.getcallstack() do
    print(index, frame.func, frame.currentline)
end

Notes

These are Game executor contracts. Check build requirements and session lifetimes before using them.