Debug

getproto

Returns a nested prototype from a function by one-based index.

Syntax

getproto(target: function | integer, index: number | integer, includeInactive?: boolean): function | table
Aliases debug.getproto

Arguments

NameTypeDescription
targetfunction | integerFunction, stack level, or prototype to inspect.
indexnumber | integerOne-based index inside constants, protos, upvalues, or stack slots.
includeInactive?booleanWhen true, inactive nested prototypes may be included when supported.

Returns

NameTypeDescription
protofunction | tableNested prototype or proxy at the requested index.

Description

Returns a nested prototype from a function by one-based index.

Call it with 3 parameter(s): target, index, includeInactive. The argument table explains which values are required and which ones only refine the behavior.

It returns proto (function | table). Use the returns table to separate successful values from nil results and recoverable errors.

Example

Example call with placeholder values.

local result = getproto(1, 1, true)
print(result)