Function filter options
Function filters let you refine what types of Luau functions should be returned when using filtergc
with "function"
as the filter type.
Each key in the filter table specifies a criterion that must be matched by the function for it to be returned. You can use one or multiple fields together to narrow your results.
Available options
Key | Type | Description | Default |
---|---|---|---|
Name |
string? |
If provided, filters out functions which don't match this name. | nil |
IgnoreExecutor |
boolean? |
If true , filters out functions that were created inside the executor. |
true |
Hash |
string? |
Filters by the hash of the function. See getfunctionhash . |
nil |
Constants |
{ any }? |
Also includes functions that contain the matching constants in the provided list. | nil |
Upvalues |
{ any }? |
Also includes functions that contain the matching upvalues in the provided list. | nil |
Notes
- These filters work based on narrowing - the more information you provide in the filters, the more accurate the final result.
- If
IgnoreExecutor
is not explicitly set tofalse
, executor-created functions are skipped by default. - Filters like
Constants
,Upvalues
, andHash
do not apply to C closures.
Examples
False negatives may occur
Executing these examples multiple times in a short period of time may result in false negatives.
Using Name
(returns a table
by default)
Matching a function by name | |
---|---|
Using Name
with returnOne = true
Single match using returnOne | |
---|---|