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 script16 MiB
Callback execution100,000 instructions, 20 ms CPU, or 100 ms elapsed
Source file256 KiB
Running modules32
Per-script rotating log1 MiB, previous copy in .log.1
HTTP response64 KiB; 10-second timeout

You can use the base, 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.

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