> ## Documentation Index
> Fetch the complete documentation index at: https://docs.projectreal.gg/llms.txt
> Use this file to discover all available pages before exploring further.

# filtergc

> 指定した filters に一致する live garbage-collected tables または functions を検索します。filterType は "table" または "function" である必要があります。options は table である必要があります。

<div className="real-function-page">
  ```lua theme={null}
  filtergc(filterType: string, options: table, returnOne?: boolean): table | function | nil
  ```

  ## 引数

  <ParamField path={"filterType"} type={"string"} required>
    検索する GC object type。値は lowercase に変換され、"table" または "function" である必要があります。
  </ParamField>

  <ParamField path={"options"} type={"table"} required>
    Filter table。function searches は Name, Hash, StartLine, IgnoreExecutor, IgnoreSyn, Environment, Constants, Upvalues を読みます。table searches は Metatable, Keys, Values, KeyValuePairs を読みます。
  </ParamField>

  <ParamField path={"returnOne"} type={"boolean"}>
    Optional optional boolean handling flag。true の場合、array table ではなく最初の matching object または nil を返します。
  </ParamField>

  ## 戻り値

  <ResponseField name={"result"} type={"table | function | nil"}>
    returnOne が false または omitted の場合は array table of matches。returnOne が true の場合は最初の matching table/function object または nil。
  </ResponseField>

  ## 例

  Find GC tables by key filters without relying on result order.

  ```lua theme={null}
  local marker = {
      RealDocsMarker = true,
  }

  local matches = filtergc("table", {
      Keys = { "RealDocsMarker" },
  })

  for _, value in ipairs(matches) do
      if value == marker then
          print("found marker")
          break
      end
  end

  local first = filtergc("table", {
      Keys = { "RealDocsMarker" },
  }, true)

  print(first ~= nil)
  ```
</div>
