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

# isexecutorclosure

Tells you whether a function was created by Seliware, or by Roblox.

```luau theme={null}
isexecutorclosure(func: function): boolean
```

Most commonly used to filter the `getgc()`/`filtergc()` output down to functions your script has created.

The check looks at where the closure was made, not which script it came from originally. <br /> A function *pulled* from a Roblox script's environment with `getsenv()` keeps its Roblox origin, and returns `false`.<br /> A function *produced* from that same script with `getscriptclosure()` returns `true` instead.

## Parameters

| Parameter | Type       | Description            |
| --------- | ---------- | ---------------------- |
| `func`    | `function` | The function to check. |

## Returns

`true` if `func` was created by the executor.<br /> `false` if the Roblox game has created it.

## Aliases

* `checkclosure`
* `isourclosure`

## Example

In a Roblox game, use `getgc()` and split the function results into executor-allocated vs Roblox-built.

<CodeGroup>
  ```luau Example 1 theme={null}
  <<<<<<< HEAD
  local isExec = isexecutorclosure(print)
  =======
  -- isexecutorclosure(func: function): boolean
  >>>>>>> 50e30f53759b0538759af25c9b271514aa2c9290
  ```

  ```luau Example 2 theme={null}
  local mine, theirs = 0, 0
  for _, fn in ipairs(getgc()) do
      if type(fn) == "function" then
          if isexecutorclosure(fn) then
              mine += 1
          else
              theirs += 1
          end
      end
  end

  print(`executor-allocated: {mine}, Roblox-allocated: {theirs}`)
  ```
</CodeGroup>

<Tip>
  Useful for detecting whether a callback has been hooked by another executor script.
</Tip>
