Yuari
Documentation
Docs/Filter/ArgCountFilter.new

ArgCountFilter.new

ArgCountFilter.new creates a filter that checks the argument count.

Syntax

ArgCountFilter.new(argument_count: number) -> ArgCountFilter

Parameters

ParameterTypeDescription
argument_countnumberExact number of arguments required for a match.

Returns

TypeDescription
ArgCountFilterA filter that matches when the call passes exactly the stored number of arguments.

Description

ArgCountFilter.new stores an exact argument count. During evaluation the filter compares it with the number of arguments supplied to the routed function, including the implicit self argument when the call is a method.

The count is fixed at construction; create a new filter if the expected arity changes.

Example

local twoArguments = ArgCountFilter.new(2)
print(twoArguments) -- ArgCountFilter

Notes

  • hookfunction accepts a filter as an optional third argument; getfilter accepts one directly.
  • Zero is a valid argument count.