Yuari
Documentation
Docs/Debug/debug.getproto

debug.getproto

Returns child protos. Global: getproto / getprotos.

Syntax

debug.getproto(func: any, index?: number) -> any

Parameters

ParameterTypeDescription
funcanyThe func value used by the call.
index?numberA one-based index.

Returns

TypeDescription
anyChild protos

Description

debug.getproto is part of the Debug library. The debug library exposes the internals of the active Luau state, including protos, constants, upvalues and stack frames.

The call is read-only: it resolves the current value when invoked and does not change the underlying state.

The aliases debug.getprotos(func) resolve to the same implementation.

Example

local function outer()
    local function inner() end
    return inner
end
print(debug.getproto(outer, 1))
print(#debug.getprotos(outer))

Notes

  • Aliases: debug.getprotos(func).
  • Writing protos, constants or upvalues can corrupt a running function; test changes carefully.