Debug libraryOverview
debug.getupvalues
Represents inspection of captured closure values.
Aliases
getupvaluesDetails#
Returns captured values indexed from 1 for a Luau function or positive stack level. Values referencing tables remain shared. Nil slots create holes, so pairs is more appropriate than relying on the table length.
Examples#
Example
local state = { count = 3 }
local function read() return state.count end
for index, value in pairs(debug.getupvalues(read)) do
print(index, type(value))
end