Debug

getproto

按从一开始的索引从函数返回嵌套原型。

语法

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

参数

名称类型描述
targetfunction | integer要检查的函数、堆栈级别或原型。
indexnumber | integer常量、原型、上值或堆栈槽内基于一的索引。
includeInactive?boolean如果为 true,则在支持时可以包含非活动嵌套原型。

返回值

名称类型描述
protofunction | table在请求的索引处嵌套原型或代理。

说明

按从一开始的索引从函数返回嵌套原型。

使用 3 个参数调用: target, index, includeInactive。参数表会说明哪些值必填,哪些值只用于细化行为。

返回 proto (function | table)。使用返回表区分成功值、nil 结果和可恢复错误。

示例

使用占位值的示例调用。

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