ProtoProxy

Represents a nested Luau prototype without presenting it as an activated closure.

Creation

debug.getproto and debug.getprotos return ProtoProxy values unless activated closures are explicitly requested.

Properties

proxy.CodeHash: number

CodeHash is a signed 32-bit hash of the prototype's instructions. It is useful for comparing proxies during the same executor version, but it is not a cryptographic digest.

Supported Functions

A ProtoProxy can be passed to:

  • debug.getproto and debug.getprotos
  • debug.getconstant and debug.getconstants
  • debug.setconstant
  • debug.getinfo and debug.setinfo
  • Luau's debug.info

Calling a ProtoProxy is accepted by its metatable but returns no values and does not execute the nested function.

local function outer()
    local function inner()
        return "value"
    end
    return inner
end

local proxy = debug.getproto(outer, 1)
print(typeof(proxy)) -- ProtoProxy
print(proxy.CodeHash)
print(proxy()) -- nil; the nested function is not executed