network.remove_receive_hook

Removes an incoming packet observer.

Syntax

Signature
network.remove_receive_hook(Hook: number | function) -> boolean

Aliases

  • raknet.remove_receive_hook
  • packets.remove_receive_hook
  • RakNet.remove_receive_hook
  • network.removereceivehook
  • raknet.removereceivehook
  • packets.removereceivehook
  • RakNet.removereceivehook

Parameters

ParameterTypeDescription
Hooknumber | functionID returned by registration, or the registered callback.

Returns

TypeDescription
booleanWhether at least one hook was removed.

Notes

Removes incoming hooks matching a hook ID or the exact callback function. Passing a callback removes every matching hook in that direction.

Example

Luau
local Hook = network.add_receive_hook(function(Packet)
    print(Packet.type)
end)
print(network.remove_receive_hook(Hook))