---
title: "filtergc"
description: "Filters GC objects by function/table criteria; also supports filtergc(predicate)."
---

```lua
filtergc(kind: string, options: table? = {}, returnOne: boolean? = false): any
```

---

## Aliases

None.

---

## Arguments

<ParamField body="kind" type="string" required>
  The object category to match: exactly "function" or "table".
</ParamField>

<ParamField body="options" type="table" default={"{}"}>
  The function/table filter criteria. See Filter options under Related types.
</ParamField>

<ParamField body="returnOne" type="boolean" default={"false"}>
  When true, return the first matching object instead of an array.
</ParamField>

---

## Returns

<ResponseField name="matches" type="any">
  An array of matches, or the first match/nil when returnOne is true. The predicate overload always returns an array.
</ResponseField>

kind is exactly function or table. returnOne returns one match or nil; otherwise an array. Function options default IgnoreExecutor to true and mutate the passed options table. Predicate failures are swallowed. See options below.

**Related types:** [Scripts types & behavior](/reference/scripts/types).

---

## Example

```lua
local marker = {ByteDocsMarker = true}
local matches = filtergc("table", {Keys = {"ByteDocsMarker"}})
print(#matches, marker.ByteDocsMarker)
```
