debug.getproto
Returns a function nested inside another. Pass active to get the live closures instead of the prototype.
Signature
debug.getproto(fn: function | number, index: number, active: boolean?): function | { function }Parameters
fnfunction | numberThe parent function.
indexnumber1-based prototype index.
activeboolean?Return live closures rather than the prototype.
Returns
function
Example
local function outer()
local function inner()
return "inside"
end
return inner
end
local inner = debug.getproto(outer, 1, true)[1]
print(inner()) --> inside