Repository navigation
LuaAPI Safety and Languages
itvnnnd87 edited this page Oct 24, 2026
·
1 revision
- Save every
.lua/.xml/.ini/.txtfile as UTF-8 (.luafiles 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).
- A script error does not crash the GameServer: the error is logged (file + line) and the server keeps running.
- Every module attached with
BridgeFunctionAttachruns 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.
| 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.
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 tableTwo 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