Limits

Every numeric limit of xiao.packet in one table.

Every limit of xiao.packet, in one place.

Sending

Limit Value Behavior
Payload sent 512 bytes writing past it raises packet payload exceeds 512 bytes; send_raw returns it as an error, send_fields returns packet payload exceeds 512 bytes (<n> encoded)
Pending sends 8 (capacity()) a ninth send returns false, "send queue full, retry next frame"
Wait of a send 2 seconds dropped when the game sends no packet on the connection in that time
Send order order of the send calls each send gets a sequence number, the flush sorts by it
encode and hook replacements no size limit only the fields table limits below apply

Values

Limit Value Behavior
Packet id 0 to 1023 other ids raise integer out of range
Integers range of the wire type, no fraction otherwise integer out of range
64-bit values exact up to 2^53 fields() gives larger values as decimal strings and the encoder takes them back
Fields table 65536 values, 64 levels deep fields table has more than 65536 values, fields table nested too deep

Receiving

Limit Value Behavior
Packets queued per frame 4096 extra packets are lost and counted by dropped()
Payload captured 64 KiB longer payloads are cut and msg.complete is false
Receivers of a frame 100 ms, in their own call before the frame callbacks over it the VM is stopped with script timeout

Hooks

Limit Value Behavior
Hooks installed 64 more raise too many packet hooks (64)
Wait for the VM 1 ms packet passes unchanged, counted in busy
Budget per packet 2 ms, from the packet arrival packet passes unchanged, counted in overruns
Overruns in a row 3 the hook is removed
Payload 64 KiB longer payloads pass unchanged
Incoming replacement size of the receive buffer of the game longer passes unchanged
Instruction check every 1000 Lua instructions budget is tested there

The xiao.cmd callbacks have their own limits, see Threads and time budget.

Packet log copy

Limit Value Behavior
Payload copied 4 MiB PACKET TOO LARGE
Values before the p table 150 past 150 values and enum tables (Copy as Lua) or reads (Copy as receiver), they move to a p table to stay under 200 locals
Enum table 16 names larger enums only list the names the packet uses
Printed fields 6 Copy as receiver prints the first 6 fields
Inline byte lines 32 bytes per line, runs over 256 bytes emitted as write_bytes("\x..") lines