protocol
Functions:
on_receive
protocol.on_receive(packet_type: string, callback: function)
packet_type
string
Packet type to listen to
callback
function
Callback function. The first parameter is the PacketWrapper object, and the second parameter is the Player object。
Registers a callback function that is called when the server receives a packet of the specified type.
on_send
protocol.on_send(packet_type: string, callback: function)
packet_type
string
Packet type to listen to
callback
function
Callback function. The first parameter is the PacketWrapper object, and the second parameter is the Player object。
Registers a callback function that is called when the server sends a packet of the specified type.
send_packet
protocol.send_packet(player_name: string, packet: pktWrapper)
protocol.send_packet(player_name: string, packet_type: string, data: table)
player_name
string
Player name
packet
pktWrapper
PacketWrapper object
packet_type
string
Packet type
data
table
Data of packet
Sends a packet to the specified player.
create_packet
protocol.create_packet(packet_type: string): pktWrapper
packet_type
string
Packet type
Creates a new packet.
Methods:
🗳️ pktWrapper
pktWrapperPacketContainer's dynamic method forwarding, so you can use all the methods in PacketContainer.
Last updated
