Syntax
getupvalue(target: function | integer, index: number | integer): anyAliases
debug.getupvalueArguments
| Name | Type | Description |
|---|---|---|
target | function | integer | Function, stack level, or prototype to inspect. |
index | number | integer | One-based index inside constants, protos, upvalues, or stack slots. |
Returns
| Name | Type | Description |
|---|---|---|
upvalue | any | Upvalue at the requested index. |
Description
Reads an upvalue from a function by one-based index.
Call it with 2 parameter(s): target, index. The argument table explains which values are required and which ones only refine the behavior.
It returns upvalue (any). Use the returns table to separate successful values from nil results and recoverable errors.
Example
Example call with placeholder values.
local result = getupvalue(1, 1)
print(result)