Returns upvalue index of target.
Every function on this page is reachable both as debug.<name> and as a plain global of the same name, so debug.getupvalues(f) and getupvalues(f) are the same call.

Parameters

function | number
required
The function to inspect, or a stack level. Level 1 is your caller.
number
required
The upvalue index, from 1.

Returns

any
The upvalue.

Behavior

  • C closures are accepted here. Unlike the bytecode functions, reading an upvalue works on a C closure that has them.

Example

Errors