Aliases

  • getproto

Arguments

function | number
required
The function to inspect, or a positive stack level identifying a caller.
number
required
A 1-based slot index.
boolean
default:"false"
Select the active prototype mode. The behavior differs between getproto and getprotos.

Returns

function | {function} | nil
A cloned nested closure, live matching closures in active mode, or nil.
active=false returns a new closure; true scans GC for closures using that prototype. Cloned closures do not guarantee initialized captured upvalues; do not blindly invoke them. Related types: Debug types & behavior.

Example