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

---
title: esp
description: Custom ESP element registration
icon: eye
---

The `esp` namespace registers custom ESP elements on the built-in ESP classes.

<Info>
  **Class names** — available ESP classes: `enemy`, `team`, `self`.
</Info>

## new\_text

```lua
esp.esp_class:new_text(name: string, preview: string, callback: function): esp_group
```

> Registers ESP text to the specified class. The callback function is called every frame. It is passed an entity pointer. Return a string in order to manage the output.

<Schema title="Parameters">
  <SchemaField name="name" type="string" required>
    ESP element picker text.
  </SchemaField>

  <SchemaField name="preview" type="string" required>
    ESP preview text.
  </SchemaField>

  <SchemaField name="callback" type="function" required>
    Function that will be called for each entity while drawing the ESP.
  </SchemaField>
</Schema>

<Schema title="Returns">
  <SchemaField name="group" type="esp_group">
    The registered ESP group.
  </SchemaField>
</Schema>

## new\_bar

```lua
esp.esp_class:new_bar(name: string, callback: function): esp_group
```

> Registers an ESP bar to the specified class. The callback function is called every frame. Access the entity pointer using the arguments of the specified callback. Return a boolean followed by the number in the range \[0.0, 1.0].

<Schema title="Parameters">
  <SchemaField name="name" type="string" required>
    ESP element picker text.
  </SchemaField>

  <SchemaField name="callback" type="function" required>
    Function that will be called for each entity while drawing the ESP.
  </SchemaField>
</Schema>

<Schema title="Returns">
  <SchemaField name="group" type="esp_group">
    The registered ESP group.
  </SchemaField>
</Schema>

## new\_item

```lua
esp.esp_class:new_item(name: string): esp_group
```

> Registers an ESP item that is neither text nor a bar.

<Schema title="Parameters">
  <SchemaField name="name" type="string" required>
    ESP element picker text.
  </SchemaField>
</Schema>

<Schema title="Returns">
  <SchemaField name="group" type="esp_group">
    The registered ESP group.
  </SchemaField>
</Schema>

<AccordionGroup>
  <Accordion title="struct esp_group">
    <Schema>
      <SchemaField name="get" type="function">
        Returns the value of the item.
      </SchemaField>

      <SchemaField name="set" type="function">
        Sets the value of the item.
      </SchemaField>

      <SchemaField name="name" type="function">
        Returns the name of the item. If the argument is present, the name is set to the new value.
      </SchemaField>

      <SchemaField name="create" type="function">
        Attaches a group to the current item.
      </SchemaField>
    </Schema>
  </Accordion>
</AccordionGroup>
