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

# Getting started

> Set up Starline Lua scripts, reload them, and learn which libraries and runtime features are available.

## Directory

Scripts go in `Documents\Starline\scripts`, which is created on first inject. Each top-level `.lua` file is a script. Shared modules go in `scripts\lib`.

## Example

```lua theme={"dark"}
local g = ui.Group("my script")
local enabled = g.Checkbox("enabled", false)

events.On("createmove", function(cmd)
    if enabled:Get() then
        cmd.forwardmove = 1
    end
end)
```

## Reload

Saving the file reloads an enabled script, as long as the Scripts tab is open. Widget values survive the reload (matched by tab/group/label; renamed widgets reset).

## Libraries

Shared `.lua` files go in `scripts\lib\`. `require("name")` loads `scripts\lib\name.lua` and returns whatever it returns.

```lua theme={"dark"}
-- scripts/lib/hooking.lua
local M = {}
function M.jmp(addr, fn) --[[ ... ]] end
return M
```

```lua theme={"dark"}
-- scripts/my_script.lua
local hooking = require("hooking")
```

Names may contain only letters, digits, `_`, and `-`. Results are cached during each refresh pass. Editing a module takes effect when a dependent script reloads. Module globals stay in the module's environment. Cyclic imports error.

## Output

`print` writes to the game console. Errors appear there in red.

## Standard library

Available: `base`, `table`, `string`, `math`, `bit`, `jit`.

Stripped: `io`, `os`, `debug`, `package` (`require` is provided, see above), bytecode loading, and the filesystem loaders `loadfile` / `dofile`. `load` and `loadstring` still work. For saving state and settings use [`file`](/file).

The JIT compiler is off. Scripts run interpreted.

## FFI

`ffi` is a global; no `require` needed. See the [LuaJIT FFI docs](https://luajit.org/ext_ffi.html) for [API](https://luajit.org/ext_ffi_api.html) and [semantics](https://luajit.org/ext_ffi_semantics.html).

```lua theme={"dark"}
local pFlashAlpha = ffi.cast("float*", pawn.address + cheat.SchemaOffset("C_CSPlayerPawnBase->m_flFlashMaxAlpha"))
```

`ffi.load` is disabled. Prefer [`entity.*`](/entity) for schema fields.
