RakNet

RakNet.remove_receive_hook

Removes a receive hook previously registered with the same callback closure.

Syntax

RakNet.remove_receive_hook(callback: function)
Aliases raknet.remove_receive_hook

Arguments

NameTypeDescription
callbackfunctionThe callback closure to remove from incoming packet hooks.

Description

Removes a receive hook previously registered with the same callback closure. The function returns no values whether or not a matching hook was present.

Call it with 1 parameter(s): callback. The argument table explains which values are required and which ones only refine the behavior.

It does not return data. Treat the call as an action and handle errors around the call site when needed.

Example

Remove a receive hook by passing the same callback closure that was registered.

local function onReceive(packet)
    print(packet.Size)
end

if raknet.is_enabled then
    raknet.add_receive_hook(onReceive)
    raknet.remove_receive_hook(onReceive)
end