debug.getupvalues
Returns every upvalue captured by a closure.
Signature
debug.getupvalues(fn: function | number): { any }Parameters
fnfunction | numberThe closure to inspect.
Returns
{ any }
Example
local a, b = 1, 2
local function sum()
return a + b
end
for index, value in debug.getupvalues(sum) do
print(index, value)
end