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

# isnewcclosure

Tells you whether a function is a `newcclosure`-wrapped C closure.

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

Most commonly used to filter `getgc()` or `filtergc()` output down to wrapped Luau functions - the hooks and disguises another script left behind.

A <abbr title="A function written in C (by Roblox itself), not in Luau. Example: print, task.wait, error, math.sqrt, etc.">C function made by roblox</abbr> and a `newcclosure`-wrapped one both return `true` from `iscclosure`. `isnewcclosure` is the only built-in predicate that separates the two.

## Parameters

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

## Returns

`true` if `func` was produced by `newcclosure`, `false` otherwise. A plain Luau function, a real Roblox C function like `print`, and the executor's own C closures all return `false`.

## Example

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

  ```luau Example 2 theme={null}
  local wrapped, builtin = 0, 0
  for _, fn in ipairs(getgc()) do
      if type(fn) == "function" and iscclosure(fn) then
          if isnewcclosure(fn) then
              wrapped += 1
          else
              builtin += 1
          end
      end
  end

  print(`wrapped Luau: {wrapped}, engine builtins: {builtin}`)
  ```
</CodeGroup>

<Tip>
  Used to verify if a C function is native or a wrapped Lua function.
</Tip>
