Aliases

  • setupvalue

Arguments

function | number
required
The function to inspect, or a positive stack level identifying a caller.
number
required
A 1-based slot index.
any
required
The replacement captured value.

Returns

function
The resolved target function after its upvalue is changed.
Requires a valid existing slot. The resolved target function remains on the native stack and is returned; this is not the standard Lua upvalue-name return. Related types: Debug types & behavior.

Example