> Agent-readable docs index: /llms.txt. Download /docs.zip to grep all markdown files locally.

---
title: JIT
icon: clock-check
---

# <ApiPageIcon icon="clock-check" />JIT

<Heading level={2} id="jit-1">
  jit

  <ApiTag label="global table" />
</Heading>

The `jit` library controls the LuaJIT just-in-time compiler at runtime.
You can use it through the global `jit` or get it with `require("jit")`.

<ApiMembers>
  <ApiMember kind="prop" name="jit.arch" summary="Target CPU architecture." ret="[[{&#x22;s&#x22;:&#x22;\&#x22;&#x22;},{&#x22;s&#x22;:&#x22;x64&#x22;},{&#x22;s&#x22;:&#x22;\&#x22;&#x22;}]]" />

  <ApiMember kind="prop" name="jit.os" summary="Target OS name." ret="[[{&#x22;s&#x22;:&#x22;\&#x22;&#x22;},{&#x22;s&#x22;:&#x22;Windows&#x22;},{&#x22;s&#x22;:&#x22;\&#x22;&#x22;}]]" />

  <ApiMember kind="prop" name="jit.version" summary="LuaJIT version string" ret="[[{&#x22;s&#x22;:&#x22;string&#x22;,&#x22;k&#x22;:&#x22;prim&#x22;,&#x22;h&#x22;:&#x22;/cs2/api_reference/lua/base#string&#x22;}]]" />

  <ApiMember kind="prop" name="jit.version_num" summary="Numeric version" ret="[[{&#x22;s&#x22;:&#x22;number&#x22;,&#x22;k&#x22;:&#x22;prim&#x22;,&#x22;h&#x22;:&#x22;/cs2/api_reference/lua/base#number&#x22;}]]" />

  <ApiMember kind="fn" name="jit.on" summary="Enables JIT compilation for the function `func`. Pass `true` to select the function that calls `jit.on`." args="func?, recursive?" sig="[{&#x22;s&#x22;:&#x22;jit.on&#x22;},{&#x22;s&#x22;:&#x22;(&#x22;},{&#x22;s&#x22;:&#x22;[&#x22;},{&#x22;s&#x22;:&#x22;func&#x22;},{&#x22;s&#x22;:&#x22;: &#x22;},{&#x22;s&#x22;:&#x22;function&#x22;,&#x22;k&#x22;:&#x22;prim&#x22;,&#x22;h&#x22;:&#x22;/cs2/api_reference/lua/base#function&#x22;},{&#x22;s&#x22;:&#x22;|&#x22;},{&#x22;s&#x22;:&#x22;true&#x22;,&#x22;k&#x22;:&#x22;prim&#x22;},{&#x22;s&#x22;:&#x22;, &#x22;},{&#x22;s&#x22;:&#x22;recursive&#x22;},{&#x22;s&#x22;:&#x22;: &#x22;},{&#x22;s&#x22;:&#x22;boolean&#x22;,&#x22;k&#x22;:&#x22;prim&#x22;,&#x22;h&#x22;:&#x22;/cs2/api_reference/lua/base#boolean&#x22;},{&#x22;s&#x22;:&#x22;]&#x22;},{&#x22;s&#x22;:&#x22;)&#x22;}]" params="[{&#x22;n&#x22;:&#x22;func&#x22;,&#x22;t&#x22;:[{&#x22;s&#x22;:&#x22;function&#x22;,&#x22;k&#x22;:&#x22;prim&#x22;,&#x22;h&#x22;:&#x22;/cs2/api_reference/lua/base#function&#x22;},{&#x22;s&#x22;:&#x22;|&#x22;},{&#x22;s&#x22;:&#x22;true&#x22;,&#x22;k&#x22;:&#x22;prim&#x22;}],&#x22;d&#x22;:&#x22;The function to enable, or `true` for the calling function.&#x22;,&#x22;o&#x22;:true},{&#x22;n&#x22;:&#x22;recursive&#x22;,&#x22;t&#x22;:[{&#x22;s&#x22;:&#x22;boolean&#x22;,&#x22;k&#x22;:&#x22;prim&#x22;,&#x22;h&#x22;:&#x22;/cs2/api_reference/lua/base#boolean&#x22;}],&#x22;d&#x22;:&#x22;Whether to also enable sub-functions recursively.&#x22;,&#x22;o&#x22;:true}]">
    <ApiNotes>
      If `recursive` is `true`, the function and all functions defined inside it are selected. If
      `recursive` is `false`, only the functions defined inside it are selected. If `recursive` is
      omitted, only the function itself is selected.

      All scripts share one JIT compiler, so a call without a function, or with `nil`, is ignored.
      In a developer extension, the first ignored call also adds a warning to the Errors list of the
      script. If `func` is any other value that is not a function, an error is thrown.
    </ApiNotes>
  </ApiMember>

  <ApiMember kind="fn" name="jit.off" summary="Disables JIT compilation for the function `func`. Pass `true` to select the function that calls `jit.off`." args="func?, recursive?" sig="[{&#x22;s&#x22;:&#x22;jit.off&#x22;},{&#x22;s&#x22;:&#x22;(&#x22;},{&#x22;s&#x22;:&#x22;[&#x22;},{&#x22;s&#x22;:&#x22;func&#x22;},{&#x22;s&#x22;:&#x22;: &#x22;},{&#x22;s&#x22;:&#x22;function&#x22;,&#x22;k&#x22;:&#x22;prim&#x22;,&#x22;h&#x22;:&#x22;/cs2/api_reference/lua/base#function&#x22;},{&#x22;s&#x22;:&#x22;|&#x22;},{&#x22;s&#x22;:&#x22;true&#x22;,&#x22;k&#x22;:&#x22;prim&#x22;},{&#x22;s&#x22;:&#x22;, &#x22;},{&#x22;s&#x22;:&#x22;recursive&#x22;},{&#x22;s&#x22;:&#x22;: &#x22;},{&#x22;s&#x22;:&#x22;boolean&#x22;,&#x22;k&#x22;:&#x22;prim&#x22;,&#x22;h&#x22;:&#x22;/cs2/api_reference/lua/base#boolean&#x22;},{&#x22;s&#x22;:&#x22;]&#x22;},{&#x22;s&#x22;:&#x22;)&#x22;}]" params="[{&#x22;n&#x22;:&#x22;func&#x22;,&#x22;t&#x22;:[{&#x22;s&#x22;:&#x22;function&#x22;,&#x22;k&#x22;:&#x22;prim&#x22;,&#x22;h&#x22;:&#x22;/cs2/api_reference/lua/base#function&#x22;},{&#x22;s&#x22;:&#x22;|&#x22;},{&#x22;s&#x22;:&#x22;true&#x22;,&#x22;k&#x22;:&#x22;prim&#x22;}],&#x22;d&#x22;:&#x22;The function to disable, or `true` for the calling function.&#x22;,&#x22;o&#x22;:true},{&#x22;n&#x22;:&#x22;recursive&#x22;,&#x22;t&#x22;:[{&#x22;s&#x22;:&#x22;boolean&#x22;,&#x22;k&#x22;:&#x22;prim&#x22;,&#x22;h&#x22;:&#x22;/cs2/api_reference/lua/base#boolean&#x22;}],&#x22;d&#x22;:&#x22;Whether to also disable sub-functions recursively.&#x22;,&#x22;o&#x22;:true}]">
    <ApiNotes>
      If `recursive` is `true`, the function and all functions defined inside it are selected. If
      `recursive` is `false`, only the functions defined inside it are selected. If `recursive` is
      omitted, only the function itself is selected.

      All scripts share one JIT compiler, so a call without a function, or with `nil`, is ignored.
      In a developer extension, the first ignored call also adds a warning to the Errors list of the
      script. If `func` is any other value that is not a function, an error is thrown.
    </ApiNotes>
  </ApiMember>

  <ApiMember kind="fn" name="jit.flush" summary="Flushes the compiled JIT code of the function `func`. Pass `true` to select the function that calls `jit.flush`. Pass a trace number to flush only that trace." args="func?, recursive?" sig="[{&#x22;s&#x22;:&#x22;jit.flush&#x22;},{&#x22;s&#x22;:&#x22;(&#x22;},{&#x22;s&#x22;:&#x22;[&#x22;},{&#x22;s&#x22;:&#x22;func&#x22;},{&#x22;s&#x22;:&#x22;: &#x22;},{&#x22;s&#x22;:&#x22;function&#x22;,&#x22;k&#x22;:&#x22;prim&#x22;,&#x22;h&#x22;:&#x22;/cs2/api_reference/lua/base#function&#x22;},{&#x22;s&#x22;:&#x22;|&#x22;},{&#x22;s&#x22;:&#x22;true&#x22;,&#x22;k&#x22;:&#x22;prim&#x22;},{&#x22;s&#x22;:&#x22;, &#x22;},{&#x22;s&#x22;:&#x22;recursive&#x22;},{&#x22;s&#x22;:&#x22;: &#x22;},{&#x22;s&#x22;:&#x22;boolean&#x22;,&#x22;k&#x22;:&#x22;prim&#x22;,&#x22;h&#x22;:&#x22;/cs2/api_reference/lua/base#boolean&#x22;},{&#x22;s&#x22;:&#x22;]&#x22;},{&#x22;s&#x22;:&#x22;)&#x22;}]" params="[{&#x22;n&#x22;:&#x22;func&#x22;,&#x22;t&#x22;:[{&#x22;s&#x22;:&#x22;function&#x22;,&#x22;k&#x22;:&#x22;prim&#x22;,&#x22;h&#x22;:&#x22;/cs2/api_reference/lua/base#function&#x22;},{&#x22;s&#x22;:&#x22;|&#x22;},{&#x22;s&#x22;:&#x22;true&#x22;,&#x22;k&#x22;:&#x22;prim&#x22;}],&#x22;d&#x22;:&#x22;The function to flush, or `true` for the calling function.&#x22;,&#x22;o&#x22;:true},{&#x22;n&#x22;:&#x22;recursive&#x22;,&#x22;t&#x22;:[{&#x22;s&#x22;:&#x22;boolean&#x22;,&#x22;k&#x22;:&#x22;prim&#x22;,&#x22;h&#x22;:&#x22;/cs2/api_reference/lua/base#boolean&#x22;}],&#x22;d&#x22;:&#x22;Whether to also flush sub-functions recursively.&#x22;,&#x22;o&#x22;:true}]">
    <ApiNotes>
      If `recursive` is `true`, the function and all functions defined inside it are selected. If
      `recursive` is `false`, only the functions defined inside it are selected. If `recursive` is
      omitted, only the function itself is selected.

      All scripts share one JIT compiler, so a call without a function, or with `nil`, is ignored.
      In a developer extension, the first ignored call also adds a warning to the Errors list of the
      script. If `func` is any other value that is not a function, an error is thrown.
    </ApiNotes>
  </ApiMember>

  <ApiMember kind="fn" name="jit.status" summary="Returns the current JIT status. The first return value is `true` if the JIT compiler is enabled. Subsequent return values are strings describing enabled CPU features and optimizations." args="" sig="[{&#x22;s&#x22;:&#x22;jit.status&#x22;},{&#x22;s&#x22;:&#x22;(&#x22;},{&#x22;s&#x22;:&#x22;)&#x22;},{&#x22;s&#x22;:&#x22;: &#x22;},{&#x22;s&#x22;:&#x22;boolean&#x22;,&#x22;k&#x22;:&#x22;prim&#x22;,&#x22;h&#x22;:&#x22;/cs2/api_reference/lua/base#boolean&#x22;},{&#x22;s&#x22;:&#x22;, &#x22;},{&#x22;s&#x22;:&#x22;string&#x22;,&#x22;k&#x22;:&#x22;prim&#x22;,&#x22;h&#x22;:&#x22;/cs2/api_reference/lua/base#string&#x22;}]" ret="[[{&#x22;s&#x22;:&#x22;boolean&#x22;,&#x22;k&#x22;:&#x22;prim&#x22;,&#x22;h&#x22;:&#x22;/cs2/api_reference/lua/base#boolean&#x22;}],[{&#x22;s&#x22;:&#x22;string&#x22;,&#x22;k&#x22;:&#x22;prim&#x22;,&#x22;h&#x22;:&#x22;/cs2/api_reference/lua/base#string&#x22;}]]" returns="[{&#x22;n&#x22;:&#x22;status&#x22;,&#x22;t&#x22;:[{&#x22;s&#x22;:&#x22;boolean&#x22;,&#x22;k&#x22;:&#x22;prim&#x22;,&#x22;h&#x22;:&#x22;/cs2/api_reference/lua/base#boolean&#x22;}]},{&#x22;n&#x22;:&#x22;...&#x22;,&#x22;t&#x22;:[{&#x22;s&#x22;:&#x22;string&#x22;,&#x22;k&#x22;:&#x22;prim&#x22;,&#x22;h&#x22;:&#x22;/cs2/api_reference/lua/base#string&#x22;}]}]" nodiscard />
</ApiMembers>
