Debug
getupvalues
Returns all upvalues from a Lua function or stack level as a one-based array table. Invalid stack levels raise “Level out of range”, and non-Lua functions raise “Lua function expected”. debug.getupvalues is an alias.
Documentation Index
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
Returns all upvalues from a Lua function or stack level as a one-based array table. Invalid stack levels raise “Level out of range”, and non-Lua functions raise “Lua function expected”. debug.getupvalues is an alias.
getupvalues(target: function | number): table
debug.getupvalueslocal first = "one"
local second = "two"
local function target()
return first, second
end
local upvalues = getupvalues(target)
for index, value in ipairs(upvalues) do
print(index, value)
end
print(#debug.getupvalues(target))