> For the complete documentation index, see [llms.txt](https://docs.xeutrino.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.xeutrino.com/getting-started/readme.md). Agents can also search and read this documentation through its [MCP server](https://docs.xeutrino.com/~gitbook/mcp).

# Overview

Nexus ships an embedded **Lua 5.5** interpreter so you can write custom in-game scripts for the GTA V (PS4 / Orbis) mod menu. Scripts are plain `.lua` files dropped into `/data/Nexus/Scripts/` on the console — no toolchain, no SDK, just a text file.

## What you can do

| Area                    | What it lets you do                                                       | Page                                                                        |
| ----------------------- | ------------------------------------------------------------------------- | --------------------------------------------------------------------------- |
| **Menu UI**             | Build your own submenus, buttons, checkboxes and sliders inside the menu  | [UI construction](https://docs.xeutrino.com/api-reference/ui.md)            |
| **GTA V natives**       | Call any game native (`GET_PLAYER_PED(-1)`, etc.) directly from Lua       | [Native invocation](https://docs.xeutrino.com/api-reference/natives.md)     |
| **Player context**      | Read the menu's currently selected player index                           | [Player context](https://docs.xeutrino.com/api-reference/player.md)         |
| **Script globals**      | Read & write the game's typed global slots                                | [Script globals](https://docs.xeutrino.com/api-reference/script-globals.md) |
| **Script events / TSE** | Trigger Server Events to send network events to players or session        | [Script events](https://docs.xeutrino.com/api-reference/script-events.md)   |
| **Raw memory**          | Read/write absolute addresses, patch code bytes                           | [Raw memory access](https://docs.xeutrino.com/api-reference/memory.md)      |
| **ImGui overlays**      | Draw custom windows, widgets and screen-space overlays on top of the game | [ImGui rendering](https://docs.xeutrino.com/api-reference/imgui.md)         |
| **Notifications**       | Toast messages in-game                                                    | [Notifications](https://docs.xeutrino.com/api-reference/notifications.md)   |

## How scripts run

* Each script runs in its own **coroutine** on the game's script thread.
* You can `yield` at any point (`script.yield`) — even from deep inside a function — and execution resumes exactly where it left off one frame later.
* Scripts are discovered at boot and started/stopped from the **Lua Scripts** submenu.
* ImGui drawing happens on the render thread through a safe, serialised callback mechanism (see [ImGui rendering](https://docs.xeutrino.com/api-reference/imgui.md)).

> **Important — always yield** A hard instruction-limit hook (1,000,000 instructions per resume) kills any script that loops without a `yield`, surfacing a Lua error toast instead of hard-locking the game. **Always call `script.yield` inside every loop.**

## Start here

1. [Getting started](https://docs.xeutrino.com/getting-started/getting-started.md) — write and run your first script
2. [Complete worked example](https://docs.xeutrino.com/examples/worked-example.md) — a full script end-to-end
3. Browse the API reference on the left

## Quick reference

| Category     | Functions                                                                                                                                                                 |
| ------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| UI           | `add_submenu`, `end_submenu`, `add_subtitle`, `add_button`, `add_checkbox`, `add_int_option`, `script.inject_submenu`                                                     |
| State        | `get_opt`, `set_opt`                                                                                                                                                      |
| Control      | `script.yield`, `wait`, `notify`                                                                                                                                          |
| Natives      | `native.<NAME>(...)`, bare `<NAME>(...)`                                                                                                                                  |
| Player       | `get_selected_player`                                                                                                                                                     |
| Globals      | `get_global_addr`, `get_global_int`, `get_global_float`, `set_global_int`, `set_global_float`                                                                             |
| TSE / Events | `send_tse` (`SendTSE`), `send_tse_to_player` (`SendToPlayer`), `send_tse_to_all` (`SendToAll`), `send_script_event`                                                       |
| Memory       | `get_app_base`, `read_int`, `write_int`, `read_float`, `write_float`, `write_bytes`                                                                                       |
| ImGui        | `imgui.add_draw`, `imgui.begin/end`, `imgui.text`, `imgui.button`, `imgui.checkbox`, `imgui.slider_float/int`, `imgui.combo`, `imgui.add_line/rect/circle/text`, and more |


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.xeutrino.com/getting-started/readme.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
