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_*, STAT_*, POWER_*, ACTION_* ...). |
System\Library.lua |
Ready-made Lua libraries: coins by type, scheduler, monster tracker, player object (Library). Do not edit. |
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. - A reload starts from zero: every function, event, module and file is loaded again, as on a fresh start. Nothing from the old scripts is kept:
- Lua variables, timers, attached module functions,
ActionTick, the scheduler state. - Events waiting to be delivered and database queries that have not returned yet are dropped.
-
Monster.WatchRespawn/Skill.Watchlists: call them again when your script loads. - Option tables (
Player.SetOptionTable) and blocked actions (Player.BlockAction). The GameServer recalculates the stats of the characters that had an option table, so no old bonus stays. Set them again inonPlayerLogin. - Monsters registered in
EventMonsterTrackerare removed duringonScriptUnload.
- Lua variables, timers, attached module functions,
- Saved data is not touched: characters, coins, items, buffs and the database stay as they are.
- Script errors are written to the GameServer log with the file name and line number.
Next: Events and chat commands