debug.getcallstack(startLevel?)
Returns stack frames with function, name, source, line and currentline.
Syntax
debug.getcallstack(startLevel: number?) -> {table}
Parameters
| Parameter | Type | Description |
|---|---|---|
startLevel | number | First level, defaults to 1. |
Returns
| Type | Description |
|---|---|
{table} | Entries with func, name, source, line and currentline. |
Description
Walks call levels with getinfo "flns" until the stack ends.
Logic change: each entry now also exposes currentline (the previous line field is kept for compatibility).
Example
local function inner() return debug.getcallstack() end
local stack = inner()
print(stack[1].func == inner, typeof(stack[1].currentline))