-
Notifications
You must be signed in to change notification settings - Fork 18
Filtering packets with the Lua API
Sala has support for simple Lua filters. When looking at a list of captured packets, go to View -> Apply filter and type in your filter script. The script should receive a Packet
as a variadic argument and return a boolean indicating whether the packet passes the filter. Packet
has the following members:
The packet's packet type (for example, 0x83 or 0x15). See Packet types for a list of packet types.
Returns true if Packet
is a 0x83 packet containing a subpacket with type subpacket_type
. See Packet types for a list of subpacket types (under ID_DATA).
Return true if Packet
contains a reference to the instance given by peer_id
and id
. If ref_type_filter
is provided, only the specified reference types are accepted. Otherwise all reference types are accepted.
The different reference type filters may be obtained by indexing the global variable InstRefType
with the following indices:
Deletion
Creation
SetProperty
Event
Ack
InValue
AsParent
TopReplicated
PhysicsRoot
PhysicsChild
PhysicsPlatformChild
Touched
TouchEnded
Filters may be combined with +
to construct a compound filter that includes packets that match at least one of the filters. For example:
InstRefType.Deletion + InstRefType.Event
.
local packet = ...
return packet.Type == 0x86
local packet = ...
return packet:HasSubpacket(7)
local packet = ...
return packet:ReferencesInstance(1, 1337)
local packet = ...
return packet:ReferencesInstance(1, 1337, InstRefType.SetProperty + InstRefType.Event)