Skip to content
Debug libraryOverview

debug.getupvalue

Represents inspection of an individual captured value.

Aliasesgetupvalue

Details#

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

Luau
local state = { count = 3 }
local function read() return state.count end
print(debug.getupvalue(read, 1) == state) -- true