ProtoProxy

Represents a nested Luau proto. It does not create an active closure.

Creation

debug.getproto returns a ProtoProxy by default. debug.getprotos returns an array of them.

Properties

proxy.CodeHash: number

CodeHash is a signed 32-bit hash of the proto's instructions. Use it to compare proxies on the same executor version. It is not cryptographic.

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
  • hookproto
  • restoreproto
  • isprotohooked

Calling a ProtoProxy returns no values. It does not run 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