> ## Documentation Index
> Fetch the complete documentation index at: https://lua.wingless.one/llms.txt
> Use this file to discover all available pages before exploring further.

# Entity

## Lookup

| Function | Returns | Description |
| - | - | - |
| `entity.local_pawn()` | `entity?` | Local player pawn |
| `entity.local_controller()` | `entity?` | Local player controller |
| `entity.get(index)` | `entity?` | Entity by index |
| `entity.from_handle(handle)` | `entity?` | Entity from handle integer |
| `entity.players()` | `table` | `{ { controller, pawn }, ... }` |
| `entity.all([class])` | `table` | All entities, optionally filtered by class name |

## Common methods

| Method | Returns | Description |
| - | - | - |
| `address()` | `number` | Raw pointer |
| `class_name()` | `string` | C++ class name |
| `health()` | `number` | |
| `armor()` | `number` | |
| `team()` | `number` | Team number |
| `alive()` | `bool` | |
| `name()` | `string` | Player name |
| `is_enemy()` | `bool` | |
| `is_local()` | `bool` | |

## Spatial

| Method | Returns |
| - | - |
| `origin()` | `vector` |
| `velocity()` | `vector` |
| `eye_position()` | `vector` |
| `eye_angles()` | `vector` |
| `aim_punch()` | `vector` |
| `bone(index)` | `vector` |

## State

| Method | Returns |
| - | - |
| `flags()` | `number` |
| `on_ground()` | `bool` |
| `scoped()` | `bool` |
| `observer_target()` | `entity?` |

## Controller

| Method | Returns |
| - | - |
| `pawn()` | `entity?` |
| `steam_id()` | `string` |
| `ping()` | `number` |
| `money()` | `number` |

## Weapon

| Method | Returns |
| - | - |
| `weapon()` | `entity?` |
| `weapons()` | `table` |

### weapon\_info

```lua theme={null}
local info = weapon:weapon_info()
```

Returns a table:

| Field | Type | Description |
| - | - | - |
| `def` | `number` | Item definition index |
| `name` | `string` | Internal name |
| `display` | `string` | Display name |
| `type` | `number` | 0 knife, 1 pistol, 2 smg, 3 rifle, 4 shotgun, 5 sniper, 6 mg, 7 c4, 8 taser, 9 grenade |
| `gun` | `bool` | Is a firearm |
| `clip` | `number` | Current clip |
| `reserve` | `number` | Reserve ammo |
| `max_clip` | `number` | Max clip size |
| `max_speed` | `number` | Max movement speed |
| `full_auto` | `bool` | |
| `can_shoot` | `bool` | Ready to fire |
| `inaccuracy` | `number?` | Current inaccuracy |
| `spread` | `number?` | Current spread |

## Hitboxes

```lua theme={null}
local boxes = pawn:hitboxes()
-- { { index, group, group_name, radius, center }, ... }

local head = pawn:hitbox(0)
-- vector (center of the hitbox)
```

## Bounding box

```lua theme={null}
local left, top, right, bottom = pawn:bbox()
```

Returns screen coordinates or `nil` if off-screen.

## Schema access

```lua theme={null}
local value = ent:get('C_CSPlayerPawn', 'm_iHealth', 'int')
local value = ent:get(offset, 'float')
```

Types: `int`, `uint`, `short`, `byte`, `int64`, `float`, `double`, `bool`, `ptr`, `vector`, `handle`, `string`.

### set (insecure)

```lua theme={null}
ent:set('C_CSPlayerPawn', 'm_iHealth', 'int', 100)
ent:set(offset, 'float', 1.0)
```

### vdata

```lua theme={null}
local value = weapon:vdata('m_nDamage', 'int')
local value = weapon:vdata('m_flRange', 'float', 'CCSWeaponBaseVData')
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.