raknet.add_send_hook
Registers or removes outgoing-packet callbacks.
Syntax
raknet.add_send_hook(fn: function) -> nil
Parameters
| Parameter | Type | Description |
|---|---|---|
fn | function | The function or callback to use. |
Returns
| Type | Description |
|---|---|
nil | This function does not return a value. |
Description
raknet.add_send_hook is part of the RakNet library. RakNet helpers expose the client's network stream: packet hooks, capture controls and bitstream serialization.
The operation is performed immediately using the arguments supplied at the call site.
The aliases addsendhook, remove_send_hook, removesendhook resolve to the same implementation.
Example
local id = raknet.add_send_hook(function(packet)
print(packet)
end)
raknet.remove_send_hook(id)
Notes
- Aliases:
addsendhook,remove_send_hook,removesendhook. - Packet hooks run on the network path and should return quickly.