isprotohooked

Check whether a proto is hooked.

Syntax

isprotohooked(proto: ProtoProxy) -> boolean

Parameters

ParameterTypeDescription
protoProtoProxyProto to check

Returns

TypeDescription
booleantrue if the proto is hooked; otherwise false

Example

local function container()
    local function nested()
        return 1
    end

    return nested
end

local proto = debug.getproto(container, 1)
print(isprotohooked(proto)) -- false

hookproto(proto, function()
    return 2
end)

print(isprotohooked(proto)) -- true

restoreproto(proto)
print(isprotohooked(proto)) -- false