Skip to main content
Returns functions or tables from the GC pool that match what you ask for.
filterOptions is always a table. The more criteria you pass in it, the narrower the result set. This function only sees values still referenced by a live thread. Once a reference drops, the value is gone before the call ever runs. Most commonly used to find a Luau closure to hook, or to find an object you want to investigate.

Parameters

Returns

{any} | any? - shape depends on returnOne:

Example

In a Roblox game, locate a uniquely-named Luau function with filtergc("function", {Name = "..."}, true), hook it with hookfunction, and verify the hook fires when the function is called.
Much faster than manually traversing getgc() outputs.