debug. getprotos Synchronous
getprotos
List the immediate nested prototypes compiled inside a Luau function. This helps you locate a child function before asking for its metadata or installing a proto hook.
Luau
debug.getprotos(target: DebugTarget) -> {ProtoProxy}Parameters
| Parameter | Type | Description |
|---|---|---|
target | DebugTarget | A Luau function, visible stack level, or ProtoProxy. Indexes in these APIs start at 1. |
Argument fields
Luau
DebugTarget = Function | number | ProtoProxyReturns
{ProtoProxy}An array of ProtoProxy objects in prototype order.
Example
Luau
local function factory()
local function first() end
local function second() end
return first, second
end
for index, proto in ipairs(debug.getprotos(factory)) do
print(index, debug.getinfo(proto).source)
end