Yuari
Documentation
Docs/Filter/NotFilter.new

NotFilter.new

NotFilter.new creates a filter that reverses another filter.

Syntax

NotFilter.new(target: any) -> NotFilter

Parameters

ParameterTypeDescription
targetanyFilter whose result is reversed.

Returns

TypeDescription
NotFilterA filter that inverts the result of the stored filter.

Description

NotFilter.new stores another filter and negates its result at evaluation time. The child is evaluated with the same arguments, so state changes made by the routed call still affect the check.

Use it to express exclusions, such as every argument that is not a string, without writing a custom function.

Example

local notString = NotFilter.new(TypeFilter.new(1, "string"))
print(notString) -- NotFilter

Notes

  • hookfunction accepts a filter as an optional third argument; getfilter accepts one directly.
  • The target must be a FilterBase value.
  • Filters can be nested to arbitrary depth.