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

---
title: Lua Intelligence
description: Learn how Lua examples in the docs show hover cards, signatures, diagnostics, and API links.
icon: sparkles
sidebar_position: 5
---

# Lua Intelligence

Lua Intelligence makes code examples on this site behave closer to a small
editor. When a Lua snippet is connected to the CS2 API index, important names in
the code become interactive: you can hover them, pin the card, copy the
signature, or jump to the exact API or Dumped Data page.

<Note>
  You do not need to enable anything. If a code example supports Lua
  Intelligence, the hover cards are already built into that page.
</Note>

## Try the hover

Move your cursor over names like `entity.GetLocalPlayerPawn`, `events.render`,
`pawn:IsValid`, `pawn:GetHealth`, or `m_iHealth` in the example below.

```lua luaintelligence=true luaintelligenceFocus=true lines=false semantic="lua:cs2:cs2/api_reference/introduction/lua-intelligence:0:5297e3dcdf90"
events.render(function()
    local pawn = entity.GetLocalPlayerPawn()

    if not pawn or not pawn:IsValid() or pawn:IsDormant() then
        return
    end

    print(string.format("health: %d", pawn:GetHealth()))
    print(pawn.m_iHealth)
end)
```

<Steps>
  <Step title="Hover a Lua name" icon="mouse-pointer-2">
    Hover a highlighted namespace, function, method, type, or schema field. The
    docs open a compact card with the information known about that symbol.
  </Step>

  <Step title="Click to pin the card" icon="pin">
    A hover card closes when you move away. Click the token to pin it, then move
    the mouse into the card, switch tabs, or use the buttons without losing it.
    Press `Esc` or click outside to close it.
  </Step>

  <Step title="Follow the source of truth" icon="external-link">
    Use **Open documentation** for Lua API pages and **Open schema** for Source2
    fields or enum data. Those links point to the same generated pages used by
    the rest of the docs.
  </Step>
</Steps>

## What can appear in a card

<Columns cols={2}>
  <Card title="Signature" icon="braces">
    Function and method cards show the call shape: argument names, argument
    types, and return types when the API exposes them.
  </Card>

  <Card title="Description" icon="message-circle-more">
    The short explanation comes from the addon documentation, so the hover card
    uses the same notes as the generated API page.
  </Card>

  <Card title="Parameters and returns" icon="list">
    Parameter notes and return values are shown directly in the card, which is
    useful when you only need a quick reminder.
  </Card>

  <Card title="Schema context" icon="network">
    Schema fields can show their owner, type, offset, nearby fields, enum
    members, and a link into Dumped Data.
  </Card>

  <Card title="Diagnostics" icon="circle-alert">
    If an example has a Lua problem, the token can be underlined. Hover it to
    see the message and code reported by LuaLS.
  </Card>

  <Card title="Actions" icon="copy">
    Cards can copy the symbol, copy the signature, copy a diagnostic, or open
    the related documentation page.
  </Card>
</Columns>

## Pinned card tabs

Pinned cards can show extra tabs when there is enough data:

<Tabs>
  <Tab title="Summary" icon="text">
    The default view. It includes the description, signature, type, returns,
    parameters, and useful metadata.
  </Tab>

  <Tab title="Members" icon="list-tree">
    Appears for Lua objects or tables that expose known members. Pinning lets
    you inspect more members than the compact hover preview.
  </Tab>

  <Tab title="Schema" icon="network">
    Appears when the hovered value maps to Source2 schema data. It can preview
    fields, enum members, parent types, and schema metadata.
  </Tab>

  <Tab title="Problems" icon="bug">
    Appears when the token has a diagnostic. This is where warnings and errors
    are easiest to read after pinning the card.
  </Tab>
</Tabs>

<Expandable title="Building pipeline" description="How API sources become generated pages and hover data." icon="workflow">
  This site uses a semi-automatic documentation pipeline. Some pages are written
  manually when they need human explanation, examples, or practical notes. Other
  pages are generated from the current CS2 cheat and addon data, so large
  reference sections can stay close to the real API.

  <Mermaid
    frame={false}
    chart={`%%{init: {"flowchart": {"htmlLabels": true, "curve": "basis", "nodeSpacing": 48, "rankSpacing": 58}}}%%
  flowchart TD
  Maintainer["<div class='nl-mermaid-card'><span class='nl-mermaid-card-title'>Maintainer</span><span class='nl-mermaid-card-desc'>API Docs, Events, Examples</span></div>"]
  Product["<div class='nl-mermaid-card'><span class='nl-mermaid-card-title'>CS2 Cheat</span><span class='nl-mermaid-card-desc'>Schema, ConVars, Game Events</span></div>"]
  Addon["<div class='nl-mermaid-card'><span class='nl-mermaid-card-title'>CS2 LuaCATS Sources</span><span class='nl-mermaid-card-desc'>API documentation and game data</span></div>"]
  LLS["<div class='nl-mermaid-card'><span class='nl-mermaid-card-title'>LuaLS</span><span class='nl-mermaid-card-desc'>Exports documentation</span></div>"]
  Generator["<div class='nl-mermaid-card'><span class='nl-mermaid-card-title'>Doc Generator</span><span class='nl-mermaid-card-desc'>Builds API, Pages and Link References</span></div>"]
  Pages["<div class='nl-mermaid-card'><span class='nl-mermaid-card-title'>Generated API Pages and Source2 Schema</span></div>"]
  LI["<div class='nl-mermaid-card'><span class='nl-mermaid-card-title'>Lua Intelligence</span><span class='nl-mermaid-card-desc'>Second pass over pages and snippets</span></div>"]
  Deploy["<div class='nl-mermaid-card'><span class='nl-mermaid-card-title'>Deploy</span><span class='nl-mermaid-card-desc'>Pages and Interactive Code</span></div>"]

  Maintainer --> Addon
  Product --> Addon
  Addon --> LLS
  LLS --> Generator
  Generator --> Pages
  Pages --> LI
  Addon -.-> LI
  LI --> Deploy

  classDef input fill:#0B0B0D,stroke:#82A5FF,stroke-width:1px,color:#F5F7FA
  classDef build fill:#0B0B0D,stroke:#67D4FF,stroke-width:1px,color:#F5F7FA
  classDef intelligence fill:#0B0B0D,stroke:#D4AA32,stroke-width:1px,color:#F5F7FA
  classDef deploy fill:#0B0B0D,stroke:#65A765,stroke-width:1px,color:#F5F7FA
  class Maintainer,Product,Addon input
  class LLS,Generator,Pages build
  class LI intelligence
  class Deploy deploy
  `}
  />

  <Steps>
    <Step title="API notes live with their source" icon="pencil">
      Maintainers write function overviews, parameter notes, examples, event
      descriptions, and practical explanations in LuaCATS files alongside the
      CS2 implementation and its shared modules. The docs build uses a synchronized
      copy of those sources.
    </Step>

    <Step title="Generated pages are built first" icon="files">
      LuaLS exports structured documentation, then the docs generator creates
      API pages, Source2 schema pages, and link references.
    </Step>

    <Step title="Lua Intelligence runs second" icon="sparkles">
      After pages exist, Lua Intelligence checks Lua examples against the same
      CS2 API index and attaches hover cards, diagnostics, signatures, and
      links to the rendered snippets.
    </Step>
  </Steps>
</Expandable>
