filtergc

Similar to getgc, will return Lua values that are being referenced and match the specified criteria.

function filtergc(filter_type: "function" | "table", filter_options: FunctionFilterOptions | TableFilterOptions, return_one: boolean?): (...any) -> (...any) | { [any]: any } | { (...any) -> (...any) | { [any]: any } }

Table filter options:

Key
Description
Default

Keys

If not empty, also include tables with keys corresponding to all values in this table.

nil

Values

If not empty, also include tables with values corresponding to all values in this table.

nil

KeyValuePairs

If not empty, also include tables with keys/value pairs corresponding to all values in this table.

nil

Metatable

If not empty, also include tables with the metatable passed.

nil

Hash

Filters by the hash of the function.

(See getfunctionhash)

nil

Function filter options:

Key
Description
Default

Name

If not empty, also include functions with this name.

nil

IgnoreExecutor

If true, also exclude functions made in the executor.

true

Hash

If not empty, also include functions with the specified hash of their bytecode.

nil

Constants

If not empty, also include functions with constants that match all values in this table.

nil

Upvalues

If not empty, also include functions with upvalues that match all values in this table.

nil


Parameters

  • filter_type - Specifies the type of Lua value to search for.

  • filter_options - Criteria used to filter the search results based on the specified type.

  • return_one? - A boolean that returns only the first match when true; otherwise, all matches are returned.

circle-exclamation

Examples - Function

Usage of Name and return_one? set to false (default option):

Usage of Name and return_one? set to true:


Usage of options parameter

Usage of Hash:

Usage of Constants and Upvalues:


Examples - Table

Usage of Keys and Values:

Usage of KeyValuePairs:

Usage of Metatable:

Last updated