Skip to content

LuaAPI Safety and Languages

itvnnnd87 edited this page Oct 24, 2026 · 1 revision

Languages, safety and limits

Languages and text encoding

  • Save every .lua / .xml / .ini / .txt file as UTF-8 (.lua files without BOM).
  • Write text in any language (English, Chinese, Vietnamese, Thai, Russian ...) directly in your scripts.
  • Character and account names returned by the API are UTF-8.
  • Text sent by scripts goes through the same path as the GameServer's own text, so it gets the same encoding handling (the client CodePage).

Safety

  • A script error does not crash the GameServer: the error is logged (file + line) and the server keeps running.
  • Every module attached with BridgeFunctionAttach runs isolated: if module A fails, module B still runs.
  • Character death and login events are called on the next GameServer loop, never in the middle of combat or login code.

Limits

Limit Value
Time for one GameServer call into the scripts 5 seconds (stops endless loops); over the limit the call is stopped and logged.
Script memory 1 GB.
onDBQueryResult re-running one query 20 times.
os.exit, DLL libraries Blocked.

Warning

Do not use os.execute, io.popen or busy-wait loops: they run on the main thread and freeze the GameServer.

Global names

Caution

Do not create global variables with the names of the API tables: Server Object Player Coin Message Item Map DB File Log Util Timer LoadScript or the callback names listed on the Events page. Use local variables inside modules.

local Message = "..."    -- correct
Message = "..."          -- WRONG: overwrites the Message API table

Two modules defining the same global function: the module loaded later replaces the earlier one. Prefix your functions with the module name, e.g. MyModule_OnTimer.


Next: Modules

Clone this wiki locally