filtergc

Finds live objects matching a set of filters.

Syntax

Signature
filtergc(Type: string, Options: table, First: boolean?) -> any

Aliases

This function has no aliases.

Parameters

ParameterTypeDescription
Typestringfunction or table.
OptionstableFunction filters use an exact name or hash and lists of required constants or upvalues. Table filters use lists of required keys or values, a table of required key/value pairs, or a metatable to compare by identity.
Firstboolean?Return one matching object instead of a list. Defaults to false.

Returns

TypeDescription
anyFirst matching object or nil when First is true. Otherwise a one-based result list.

Notes

Type must be lowercase function or table. Function filters support Name, Hash, Constants, Upvalues, and IgnoreExecutor. IgnoreExecutor defaults to true. Table filters support Keys, Values, KeyValuePairs, and Metatable. Every supplied filter must match.

Example

Luau
local Matches = filtergc("function", {Name = "Example", IgnoreExecutor = false})
for _, Function in Matches do
    print(Function)
end