ReferenceClosures

restoreproto

Undoes hookproto. Closures created afterwards use the original body again. It raises an error if the prototype is not hooked.

Syntax

restoreproto(proto: function)

Parameters

ParameterTypeDescription
protofunctionA prototype that was hooked with hookproto.

Example

local function outer()
    local function inner() return 1 end
    return inner
end
local proto = debug.getproto(outer, 1)
hookproto(proto, function() return 2 end)
restoreproto(proto)
print(outer()())

These are Game executor contracts. Check build requirements and session lifetimes before using them.