Debug

getupvalues

Returns all upvalues captured by a function.

Syntax

getupvalues(target: function | integer): table
Aliases debug.getupvalues

Arguments

NameTypeDescription
targetfunction | integerFunction, stack level, or prototype to inspect.

Returns

NameTypeDescription
upvaluestableArray table of captured upvalues.

Description

Returns all upvalues captured by a function.

Call it with 1 parameter(s): target. The argument table explains which values are required and which ones only refine the behavior.

It returns upvalues (table). Use the returns table to separate successful values from nil results and recoverable errors.

Example

Example call with placeholder values.

local result = getupvalues(1)
print(result)