Registers a hook on incoming packets. The callback receives a packet object, which is the same shape a send hook gets.
RakNet is off by default. The library exists only when the RakNet feature is enabled in the Athena loader, and it is published on getgenv() rather than as a plain global. Guard your code with if getgenv().raknet then ... end, or read raknet.is_enabled.

Parameters

function
required
Called as callback(packet) for each incoming packet.

Behavior

  • SetData and Block do not apply inbound. They are only valid inside a send hook and raise if called here.
  • Inbound capture depends on the transport. Check the inbound field of stats; if it is false this hook will not be called.
  • Errors are contained: a raising hook is logged and skipped.

Example

Errors