network.getstats
Reads packet counters and transport diagnostics.
Syntax
Signature
network.getstats() -> tableAliases
raknet.getstatspackets.getstatsRakNet.getstats
Parameters
This function takes no parameters.
Returns
| Type | Description |
|---|---|
table | Current counters and last send error. |
Notes
Fields are receivedPackets, sentPackets, receivedBytes, sentBytes, droppedReceived, droppedSent, editQueued, editOverflow, editExpired, editFailed, editSent, editCancelled, receiveHookDrops, and lastSendError. lastSendError is the last transport failure text.
Example
Luau
local Stats = network.getstats()
print("Sent:", Stats.sentPackets, "Received:", Stats.receivedPackets)
print("Dropped:", Stats.droppedSent, Stats.droppedReceived)
if Stats.lastSendError ~= "" then
warn("Last transport error:", Stats.lastSendError)
end