Repository navigation
LuaAPI Folder Structure
itvnnnd87 edited this page Oct 24, 2026
·
2 revisions
| Path | Contents |
|---|---|
Main.lua |
Entry point. The GameServer loads this file. Add your modules at the end. |
System\Callbacks.lua |
Game events: login, logout, death, chat commands. |
System\CallbacksDB.lua |
Database query results. |
System\Timers.lua |
Per-second / minute / hour / day-change events and the Timer.* functions. |
System\Modules.lua |
Module system: BridgeFunctionAttach and the short function names (Modules). Do not edit. |
System\Constants.lua |
Constants (OBJECT_ONLINE, CLASS_*, MAP_* ...). |
System\FileReader.lua |
Line-by-line file reader (Reader:Load). |
Includes\<Module>\... |
One folder per feature. |
- Create the folder
Includes\MyModule\and the fileIncludes\MyModule\MyModule.lua. - Add this line at the end of
Main.lua:
LoadModule("MyModule\\MyModule")A module that fails to load only breaks itself; every other module still loads.
require("A\\B") looks for LuaAPI\A\B.lua first, then LuaAPI\Includes\A\B.lua.
- The GameServer loads the scripts on startup.
- Reload without restarting: GameServer control panel (inside START) → Reload LuaAPI. This reloads
Main.lua, every module andData\Commands\LuaCommands.xml. - Reload order:
onScriptUnload(old scripts) → load the new scripts →onGameServerStart→onPlayerLoginfor every player already online. - Database queries of the old scripts that have not returned yet are dropped. Timers are cleared.
- Script errors are written to the GameServer log with the file name and line number.
Next: Events and chat commands