Yuari
Documentation
Docs/Debug/debug.getcallstack

debug.getcallstack(startLevel?)

Returns stack frames with function, name, source, line and currentline.

Syntax

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

Parameters

ParameterTypeDescription
startLevelnumberFirst level, defaults to 1.

Returns

TypeDescription
{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))