filtergc
Finds collector functions or tables matching supplied criteria.
For tables: Keys matches any listed key; Values requires every listed value; KeyValuePairs requires all exact pairs; Metatable requires that metatable. For functions: Name, Hash, Constants and Upvalues constrain the match. All listed constants and upvalues must exist. IgnoreExecutor defaults to true for functions; IgnoreSyn is an alias for that option. A first-match search returns nil when no match exists; a list search returns an empty table.
filtergc(kind: "function" | "table", options: table?, returnFirst: boolean?): anyParameters
| Parameter | Type | Description |
|---|---|---|
kind | "function" | "table" | Object type to search. |
options | table? | Criteria described below; defaults to an empty filter. |
returnFirst | boolean? | Return one matching object or nil instead of a list; defaults to false. |
Example
local matches = filtergc("table", { KeyValuePairs = { label = "example" } })
for _, value in ipairs(matches) do
print(value.label)
endExample output
examplePrints once per live table whose label field matches; emits nothing if no table satisfies the criterion.
Errors: Only "function" and "table" are accepted. This searches the current VM; a collector or criterion-read failure can raise an error.
