AnyFilter.new
AnyFilter.new creates a filter that matches when any child filter matches.
Syntax
AnyFilter.new(filters?: {FilterBase}) -> AnyFilter
Parameters
| Parameter | Type | Description |
|---|---|---|
filters? | {FilterBase} | Optional array of filters combined with logical OR. |
Returns
| Type | Description |
|---|---|
AnyFilter | A composite filter that matches when at least one child filter matches. |
Description
AnyFilter.new combines child filters with logical OR. Each child is evaluated in order until one matches, at which point evaluation stops and the call is routed to the filtered branch.
Passing no filters produces a filter that never matches, which makes it useful as a placeholder when the filter list is built dynamically.
Example
local stringOrNumber = AnyFilter.new({
TypeFilter.new(1, "string"),
TypeFilter.new(1, "number")
})
print(stringOrNumber) -- AnyFilter
Notes
- hookfunction accepts a filter as an optional third argument; getfilter accepts one directly.
- Every child must be a FilterBase value.
- An empty AnyFilter never matches.