> ## 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

> Ищет live garbage-collected tables или functions, совпадающие с переданными filters. 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, возвращает первый matching object или nil вместо array table.
  </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>
