Debug libraryOverview
debug.getupvalue
Represents inspection of an individual captured value.
Aliases
getupvalueDetails#
Reads one captured value from a Luau function or positive stack level using a one-based index. Returns the value itself, not a name/value pair. Invalid indices and C functions raise errors.
Examples#
Example
local state = { count = 3 }
local function read() return state.count end
print(debug.getupvalue(read, 1) == state) -- true