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

# Engine

> Console commands and engine queries.

## Functions

| Function | Returns | Description |
| - | - | - |
| `engine.exec(cmd)` | | Execute a console command |
| `engine.in_game()` | `bool` | Whether in a match |
| `engine.screen_size()` | `w, h` | Display resolution |
| `engine.view_angles()` | `vector` | Current view angles |
| `engine.set_view_angles(angles)` | `bool` | Set view angles |
| `engine.play_sound(event)` | | Play a Panorama sound event |
| `engine.camera_angles()` | `vector` | Camera angles without anti-aim |
| `engine.max_speed()` | `number` | Current weapon max speed |

## Prediction

### post\_state

```lua theme={null} theme={null}
local state = engine.post_state()
```

Returns the predicted local state after the last command:

| Field | Type |
| - | - |
| `origin` | `vector` |
| `velocity` | `vector` |
| `flags` | `number` |
| `on_ground` | `bool` |

### simulate

```lua theme={null} theme={null}
local result = engine.simulate(ticks [, fn])
```

Simulate `ticks` movement ticks. Available only inside `createmove`. The optional callback `fn(tick, input)` lets you modify each tick's input before it runs.

Returns a table of per-tick results with `origin`, `velocity`, `flags`, `on_ground`.

## Example

```lua theme={null} theme={null}
events.on('createmove', function(cmd)
    local future = engine.simulate(64)
    local landing = future[#future]
    if landing.on_ground then
        print('will land at ' .. tostring(landing.origin))
    end
end)
```


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