filtergc Synchronous
Search the current VM’s live functions or tables using fields that matter to you, rather than scanning every getgc result by hand. It is useful for finding a table with known keys or a Luau closure with a known hash.
Luau
filtergc(
kind: "function" | "table",
options: GcFilterOptions,
returnOne: boolean?
) -> {Function | Table} OR Function OR Table OR nilParameters
| Parameter | Type | Description |
|---|---|---|
kind | "function" | "table" | Either "function" or "table". |
options | GcFilterOptions | For functions: Name, Hash, Constants, Upvalues, IgnoreExecutor. For tables: Keys, Values, KeyValuePairs, Metatable. |
returnOne | boolean? | true returns the first match or nil; omitted or false returns all matches. |
Argument fields
Luau
GcFilterOptions = {
IgnoreExecutor: boolean?, Name: string?, Hash: string?,
Constants: Table?, Upvalues: Table?, Keys: Table?, Values: Table?,
KeyValuePairs: Table?, Metatable: Table?
}Returns
{Function | Table} OR Function OR Table OR nilAn array of matches by default; one matching value or nil when returnOne is true.
Usage notes
Function searches ignore executor-owned functions by default; set IgnoreExecutor = false to include them. Search results are a snapshot, and first-match order is unspecified.
Example
Luau
local marker = { docsExample = true }
local found = filtergc("table", { KeyValuePairs = { docsExample = true } }, true)
print(found ~= nil)
marker.docsExample = false