> For the complete documentation index, see [llms.txt](https://docs.centurion.best/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.centurion.best/macros/ctn_no_virtualize.md).

# CTN\_NO\_VIRTUALIZE

A macro that excludes a function from virtualization, running it outside the VM as raw bytecode. Use this for functions that are incompatible with the virtualizer — not for sensitive logic, as the code will be exposed.

{% hint style="danger" %}
Never wrap sensitive functions with `CTN_NO_VIRTUALIZE`. The code inside runs outside the VM and is visible as raw bytecode.
{% endhint %}

***

### Good examples

#### RenderStepped callback

Add this at the top of your script so it runs correctly in plain source.

```lua
RunService.RenderStepped(CTN_NO_VIRTUALIZE(function()
    -- regular function body
end))
```

#### Heartbeat connection

```lua
local generate_tracers = CTN_NO_VIRTUALIZE(function()
    -- function body
end)
RunService.Heartbeat:Connect(generate_tracers)
```

#### Inline call

```lua
CTN_NO_VIRTUALIZE(function()
    for _, object in getgc() do
        if type(object) == "table" then
            target = object
        end
    end
end)()
```

***

### Bad examples

#### Passing a function reference

```lua
local callback = function()
    -- function body
end
CTN_NO_VIRTUALIZE(callback) -- ❌ cannot pass reference arguments
hookfunction(collectgarbage, callback)
```

{% hint style="danger" %}
`CTN_NO_VIRTUALIZE` only accepts an inline function literal. Passing a reference does nothing.
{% endhint %}

#### Wrapping non-function syntax

```lua
CTN_NO_VIRTUALIZE( -- ❌ syntax error
    local old; old = hookmetamethod(game, "__namecall", function(...) end)
)
```

{% hint style="danger" %}
You cannot wrap arbitrary statements — only a function literal goes inside `CTN_NO_VIRTUALIZE(...)`.
{% endhint %}

#### Forgetting to call the result

```lua
CTN_NO_VIRTUALIZE(function()
    -- something
end) -- ❌ this does not run, missing () at the end

print("done")
```

{% hint style="danger" %}
If you want the function to execute immediately, you must call it: `CTN_NO_VIRTUALIZE(function() ... end)()`.
{% endhint %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.centurion.best/macros/ctn_no_virtualize.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
