---
title: "Lua scripting"
description: "Write client modules in Lua: where scripts live, how they reload, where to read next."
---

> Documentation Index
> Fetch the complete documentation index at: https://aesthetic-docs.pages.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Lua scripting

A script declares a module with settings and event handlers. The module appears in the
Scripts tab next to the built-in ones, and its settings persist the same way.

```lua title="hello.lua"
local module = ui.create("code", "Hello")

module:event("tick", function()
print("tick")
end)
```

## Where scripts live

```text
<Minecraft config folder>/aesthetic/scripts/*.lua
```

One top-level `.lua` file is one script. The folder is created on first launch, with editor
stubs beside it (`library/`, `docs/`, `.luarc.json`).

## Reload

| You do | The client does |
|--------|-----------------|
| Save a file | Reloads the script, keeping setting values and enabled state |
| Add a file | Loads it |
| Delete a file | Unloads its modules |

Every load, reload and unload prints a `lua »` line in chat.

## Errors

A load error prints in chat and the script is skipped. An error inside a callback prints and
disables the module, so it cannot spam every tick. Fix the file and save.

## Where to go next

Source: https://aesthetic-docs.pages.dev/index.md
