RakNet
Packet callbacks, packet data, and connection methods.
16 functions
What the icons meanraknet.add_receive_hookSynchronousRegister a persistent callback for incoming packets. It is useful for observing an identified packet type or changing a packet before the game receives it.
raknet.add_send_hookSynchronousRegister a persistent callback for outgoing packets. Use it for brief inspection or for a specific, intentional packet edit before the packet is sent.
raknet.is_enabledSynchronousCheck whether RakNet packet access is ready for the current game generation. Call it before registering observers or submitting a packet.
raknet.OnPacketReceive:ConnectSynchronousConnect a listener to incoming packet events. Keep the returned connection if the observer should be removed when a panel or task closes.
raknet.OnPacketReceive:OnceSynchronousObserve just the next incoming packet. The one-shot connection unregisters before the callback, so the callback cannot accidentally receive a second packet.
raknet.OnPacketReceive:WaitAsynchronousYield until the next incoming packet and receive a copied snapshot. This is useful when a coroutine needs one packet’s data after its event callback has finished.
raknet.OnPacketSend:ConnectSynchronousConnect a listener to outgoing packet events. It returns a connection object, which is convenient when an observer should live for a specific task or time window.
raknet.OnPacketSend:OnceSynchronousListen for the next outgoing packet and disconnect automatically before your callback runs. Use it for a one-packet observation without a manual cleanup path.
raknet.OnPacketSend:WaitAsynchronousWait for the next outgoing packet without writing a persistent callback. Unlike a callback’s live view, the returned snapshot remains usable after the wait completes.
raknet.receiveSynchronousSubmit an incoming packet to the game from protocol-valid data. Use it only when the receiving side is expected to understand the payload; the packet passes through incoming observers.
raknet.remove_receive_hookSynchronousUnregister a callback previously added with raknet.add_receive_hook. Use this when an inspection window or packet modification is finished.
raknet.remove_send_hookSynchronousUnregister a callback previously added with raknet.add_send_hook. Keep the exact function reference you registered so cleanup can remove it later.
raknet.sendSynchronousSubmit an outgoing RakNet packet using data you already know is valid for the game’s protocol. Manual sends pass through your outgoing packet callbacks before entering the native queue.
RakNetConnection:DisconnectSynchronousStop a packet signal connection from receiving future events. Use it to clean up a Connect or Once observer when its work is finished.
RakNetPacket:BlockSynchronousVeto the current packet before it reaches its destination. Use it with a narrow, verified condition; later observers can still inspect the view but cannot undo the block.
RakNetPacket:SetDataSynchronousReplace the bytes in the current packet view before it continues through observers and transport. Use it when you know the exact encoded packet format and need a deliberate rewrite.