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

# setstackhidden

Hides a function's frame from `debug.traceback()` output so a traceback name-scan can't find it.

```luau theme={null}
setstackhidden(func: function, hidden: boolean?): ()
```

Pass the function whose frame you want hidden. The optional `hidden` flag picks the direction: `true` keeps that call out of what `debug.traceback()` returns, `false` lets it back in.

The code still runs. Nothing about how the function behaves changes, only whether a traceback dump lists it.

Most commonly used to keep an executor function out of an anti-cheat's sight. Even after `newcclosure` wraps a script function, its Luau name can still show up in `debug.traceback()`. A game that scans the traceback for known names can then flag the user. Hiding the call makes the scan come up empty.

## Parameters

| Parameter | Type       | Description                            |
| --------- | ---------- | -------------------------------------- |
| `func`    | `function` | The function whose frame to hide.      |
| `hidden`  | `boolean?` | Whether to hide that frame or show it. |

## Returns

<code title="the function does not return a value.">void</code>

## Example

See whether your own executor leaks an injected closure's name into `debug.traceback()`. Hide the frame so a traceback name-scan can't spot it.

<CodeGroup>
  ```luau Example 1 theme={null}
  <<<<<<< HEAD
  setstackhidden(coroutine.running(), true)
  =======
  -- setstackhidden(func: function, hidden: boolean?): ()
  >>>>>>> 50e30f53759b0538759af25c9b271514aa2c9290
  ```

  ```luau Example 2 theme={null}
  local function secretFn()
      return debug.traceback()
  end

  local wrapped = newcclosure(secretFn)

  -- without this, "secretFn" still lands in the traceback
  -- even though newcclosure wrapped it - a name-scan would catch it
  setstackhidden(secretFn, true)

  local trace = wrapped()
  print(string.find(trace, "secretFn")) --> nil, the frame is hidden
  ```
</CodeGroup>

<Tip>
  Useful anti-detection mechanism to hide executor calls from client scripts.
</Tip>
