UOSAGAS Scripting

Language & Sandbox

The engine is Lua-CSharp — a managed Lua implementation targeting standard Lua semantics. Everyday Lua works exactly as you know it; the differences are in what the sandbox lets you reach.

The dialect

Tables, functions, closures, metatables (read-side), string, table, math, pairs/ipairs, tostring/tonumber, pcall — all present. Numbers accept 0x hex literals, which you will use constantly for serials and graphic ids. The same engine and dialect runs in the in-client assistant, so scripts move between both without changes.

The sandbox

Removed on purpose — scripts talk to the world only through the game API:

  • io, require, dofile, loadfile, load, package, module — no file or code loading. (Config is the supported way to persist data.)
  • os.execute, os.remove, os.rename, os.exit, os.getenv — no process/OS access (os.time and os.clock remain).
  • rawget/rawset — object tables keep their behavior.
  • debug is read-only (kept for the debugger itself).

Import instead of require

Import('name') runs another script from Data\LuaScripts in the same environment — file name only, no paths, no packages. Use it for shared helper files; whatever globals the imported file defines become available to the importer.

Errors & debugging

Runtime errors stop the script and show file, line and message in the IDE console — never a popup. pcall works if you want to survive an error. The debugger instruments each line (that is how breakpoints and stepping know where you are), pauses on breakpoints, and lets you step and inspect variables and the call stack.

Gotchas

  • Loops need Pause. The engine stops busy loops that never yield. Pause(ms) also pumps UI callbacks — without it your script windows freeze.
  • Finders return nil when nothing matches — check before indexing, or you get an error on the next line.
  • Object tables are snapshots. An item table you fetched does not update itself; re-find when you need fresh state.
  • Serials are numbers. Write them as 0x00483D2A; display them with string.format('0x%08X', serial).