filtergc
Finds live objects matching a set of filters.
Syntax
Signature
filtergc(Type: string, Options: table, First: boolean?) -> anyAliases
This function has no aliases.
Parameters
| Parameter | Type | Description |
|---|---|---|
Type | string | function or table. |
Options | table | Function 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. |
First | boolean? | Return one matching object instead of a list. Defaults to false. |
Returns
| Type | Description |
|---|---|
any | First 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