UOSAGAS Scripting

Lua

Lua is the full programming language of the assistant. Where Razor Script is a list of commands, Lua gives you real functions, tables, loops over anything — and things Razor Script simply cannot do, like building your own windows.

Why Lua

Reach for Lua when a script starts to want data: a loot filter with a config, a crafting loop with per-resource counts, a status window that follows your health. The engine exposes 92 functions across 12 modules plus a script UI API — and every script runs in a sandbox: no file access, no network, everything goes through the game API.

Where it lives

The Lua tab lists your scripts — plain .lua files in Data\LuaScripts next to the assistant. New… creates one, double-click (or the pop-out button) opens the IDE editor with Lua-aware highlighting and autocompletion for the whole API. Play runs the selected script; scripts can also be bound to hotkeys under Hot Keys → Scripts.

The debugger

The IDE is a real debugger: set breakpoints in the margin, run, and the script pauses on the line — step onwards, watch the call stack and inspect variable values. Script errors never pop up windows; they appear in the IDE console (and in Data\CrashLogs) with the exact line.

What the API covers

  • Player — speech, movement, using/equipping/moving items, war mode, and ~60 read properties (stats, resistances, flags).
  • Items / Mobiles — find by serial, type, name, layer or filter table; returned as plain Lua tables.
  • Gumps — wait for, read and answer server gumps.
  • Targeting — wait for cursors, target by serial, last target, self.
  • Spells / Skills / Journal / Messages — cast, use, read skill values and locks, watch the journal, print anywhere.
  • Config — persist script settings as JSON with two calls.
  • UI — build windows with buttons, sliders, checkboxes and live bindings.

The API reference is generated from the running engine — if a function is listed, it exists.

Where to go next

Write your first script in Getting Started, skim Language & Sandbox for the dialect rules, then keep the API reference and object fields open while you write.