Alias
debug.getprotos
Đối số
function | number
bắt buộc
Lua function or stack level whose nested functions are returned.
Giá trị trả về
table
One-based array table containing nested functions. Empty when none are present.
Documentation Index
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
Returns all nested Lua functions 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.getprotos is an alias.
getprotos(target: function | number): table
debug.getprotoslocal function outer()
local function first()
return "one"
end
local function second()
return "two"
end
return first, second
end
local protos = getprotos(outer)
for index, proto in ipairs(protos) do
print(index, type(proto))
end
print(#debug.getprotos(outer))