raknet.new
Creates a bit stream with Write, WriteString, WriteU8, WriteU16, WriteU32, WriteFloat, WriteDouble, Clear, GetLength, ToString, Send.
Syntax
raknet.new() -> nil
Parameters
This function takes no parameters.
Returns
| Type | Description |
|---|---|
nil | This function does not return a value. |
Description
raknet.new is part of the RakNet library. RakNet helpers expose the client's network stream: packet hooks, capture controls and bitstream serialization.
Each call creates or returns a fresh object or value that you can store and pass to other functions.
The aliases raknet.BitStream.new() resolve to the same implementation.
Example
local stream = raknet.new()
stream:WriteU8(1)
stream:WriteString("hello")
print(stream:GetLength())
Notes
- Aliases:
raknet.BitStream.new(). - Packet hooks run on the network path and should return quickly.