Blocking

Drop a packet id entirely, in both directions, with the script block list.

Drop a whole packet id without writing a hook. The client discards it in both directions. The script block list adds to the block list of the packet log and is cleared on Clear VM.

At a glance

Function Purpose
block(packet) drop this id
unblock(packet) stop dropping it
unblock_all() clear the script block list
is_blocked(packet) query the script block list

xiao.packet.block(packet)

xiao.packet.block(packet: number | string)

The client drops this packet id in both directions.

Name Type Description
packet number or string packet id or name

Errors: an unknown name raises unknown packet '<name>', an id outside 0 to 1023 raises integer out of range.

xiao.packet.unblock(packet)

xiao.packet.unblock(packet: number | string)

Stops dropping it. The block list of the packet log is not changed.

Name Type Description
packet number or string packet id or name

xiao.packet.unblock_all()

xiao.packet.unblock_all()

Clears the script block list.

xiao.packet.is_blocked(packet)

xiao.packet.is_blocked(packet: number | string): boolean
Name Type Description
packet number or string packet id or name

Returns: true if the id is in the script block list. The block list of the packet log is not included.


Complete example

Block Animate for as long as the script lives:

xiao.packet.block("Animate")
print(xiao.packet.is_blocked("Animate"))
xiao.signal.add("unload", "restore", function() xiao.packet.unblock_all() end)