debug.getprotos
Lists handles for a Lua function's immediate nested prototypes.
These are inactive inspection handles, not executable closures. Only immediate children are returned; inspect a child again to descend further.
debug.getprotos(subject: function | number): {function}Parameters
| Parameter | Type | Description |
|---|---|---|
subject | function | number | Lua function or reachable stack level. C functions are rejected by prototype readers. |
Example
local function outer()
local function inner() return 1 end
return inner
end
for _, handle in ipairs(debug.getprotos(outer)) do
print(debug.getinfo(handle).what)
endExample output
LuaErrors: Invalid stack levels or C-function subjects raise errors.
Aliases: getprotos.
