Sharp Aion2 Lua SDK
Build scripts

Errors and limits

Handle unavailable game values, script limits, and errors.

Return and error pattern

Many calls return a result on success or nil, error on failure. A valid false result is different from nil:

local level, err = game.local_level()
if level == nil then
    log.warn(err)
else
    log.info("Level " .. level)
end

Game information may be unavailable while loading or changing characters. Read it again when your script needs it.

Script limits

LimitCurrent value
Lua memory per script256 MiB
Callback execution40,000,000 instructions
Worker resume10,000,000 instructions
Source file8 MiB
Running modules32
Per-script rotating log1 MiB, previous copy in .log.1
HTTP response64 KiB; 10-second timeout

You can use the base, coroutine, table, string, math, and utf8 Lua libraries, plus os.clock() and os.time(). Other os functions, dofile, loadfile, load, and collectgarbage are unavailable. Import local and shared Lua files with require. os.clock() measures process CPU time rather than elapsed time.

Execution has no CPU-time or elapsed-time deadline. Instruction limits still stop runaway Lua loops. Keep long jobs cooperative so your script returns control regularly.

Coroutines run in the same script state and share the current callback's execution and memory limits. Yielding does not reset those limits within the callback. Uncached and nested require chunks also share their caller's consumed instructions; importing a library does not grant a fresh budget. Resume a cooperative job on a later tick for a fresh callback budget. script.sleep() remains restricted to the single worker created by script.start_worker(); use coroutine.yield() for jobs resumed manually from on_tick.

Lua traceback text appears in the Scripts tab and the matching logs/instant_<id>.log or logs/module_<id>.log. log.info, log.warn, and log.error write timestamped lines to that file and the console.

Calls that need the game may return nil, error when your character or world is unavailable. Check results before drawing, logging, or acting on them.

On this page