Syntax
getstack(level: number | integer, index?: number | integer): tableAliases
debug.getstackArguments
| Name | Type | Description |
|---|---|---|
level | number | integer | One-based stack level to inspect or update. |
index? | number | integer | One-based index inside constants, protos, upvalues, or stack slots. |
Returns
| Name | Type | Description |
|---|---|---|
stack | table | Stack table or selected stack value. |
Description
Reads stack values from a stack level, or one stack slot when an index is provided.
Call it with 2 parameter(s): level, index. The argument table explains which values are required and which ones only refine the behavior.
It returns stack (table). Use the returns table to separate successful values from nil results and recoverable errors.
Example
Example call with placeholder values.
local result = getstack(1, 1)
print(result)