debug. getproto Synchronous
getproto
Get one nested Luau prototype from a function. Use the default ProtoProxy for metadata or prototype hooks; request active closures when you need actual live functions.
Luau
debug.getproto(
target: DebugTarget,
index: number,
active: boolean?
) -> ProtoProxy OR {Function}Parameters
| Parameter | Type | Description |
|---|---|---|
target | DebugTarget | A Luau function, visible stack level, or ProtoProxy. Indexes in these APIs start at 1. |
index | number | One-based nested prototype slot. |
active | boolean? | Optional boolean. true searches for active closures made from that prototype. |
Argument fields
Luau
DebugTarget = Function | number | ProtoProxyReturns
ProtoProxy OR {Function}A ProtoProxy by default; with active=true, an array of matching live functions.
Usage notes
An active search can return an empty array if no matching closure is live.
Example
Luau
local function factory()
return function() return "inside" end
end
local nested = debug.getproto(factory, 1)
print(debug.getinfo(nested).source)