restoreproto(proto)
Removes a proto hook installed by hookproto.
Syntax
restoreproto(proto: function) -> boolean
Parameters
| Parameter | Type | Description |
|---|---|---|
proto | function | Same handle passed to hookproto. |
Returns
| Type | Description |
|---|---|
boolean | true when a hook was removed. |
Description
Restores the original instruction stream, constants and cached closure stack sizes, then releases the hook reference.
Returns false when the proto is not currently hooked.
Example
local proto = debug.getproto(outer, 1)
hookproto(proto, function() end)
print(restoreproto(proto)) -- true
print(restoreproto(proto)) -- false