Queues a packet of your own for sending on the live transport. data may be a string, a Luau buffer, or an array of byte numbers. A table form is also accepted for compatibility with older scripts: raknet.send({ Data = ..., Priority = ..., Reliability = ..., OrderingChannel = ..., Broadcast = ..., ForceReceiptNumber = ..., SystemIdentifier = ... }).
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

string | buffer | table
required
The payload: a string, a buffer, an array of byte numbers, or a legacy options table containing a Data field.
number
default:"2"
Send priority, 0 through 3. Ignored when the table form is used, which takes Priority instead and defaults it to 0.
number
default:"3"
Reliability mode, 0 through 7. The table form takes Reliability and defaults it to 0.
number
default:"0"
Ordering channel, 0 through 31. The table form takes OrderingChannel.

Returns

boolean
true when the packet was accepted for sending.

Behavior

  • The payload must be non-empty.
  • The two forms have different defaults. Positional arguments default to priority 2 and reliability 3; the legacy table form defaults both to 0. Pass them explicitly if it matters.
  • Sending is queued, not immediate. The packet is handed to the transport and may be sent on the engine’s thread, which is why the return value means “accepted” rather than “delivered”.

Example

Errors