Returns the upvalues target captured, as an array indexed from 1.
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.

Returns

table
An array of upvalue values.

Behavior

  • A function with no upvalues returns an empty table, not an error.
  • Values are copies at read time. To change one, use setupvalue.

Example

Errors