Introduction to Lua Scripting
What it is
Lua scripting lets you change how your server behaves without a DLL developer and without rebuilding anything. Game events call into your scripts, your scripts call back into the game, and a reload is enough to see the result. What used to be a feature request becomes a file you edit yourself.
Two plugins, one system
LuaAPI Core is the foundation. It opens the server to Lua: players, items, monsters, currencies, timers and the database. This is where behaviour lives.
LuaUI Extension adds the part the player sees: custom windows, HUD panels and popups written in Lua on both the client and the server.
The Extension builds on Core rather than replacing it. Core works on its own, the Extension does not work without Core. In practice: a daily reward announced in chat needs Core only, while the same reward presented in its own window with a claim button and a history list needs both.
What you need
- The Core plugin for any Lua scripting at all.
- The Extension plugin additionally, if you want your own interfaces.
-
Server side: enable it in
Data\Plugins\PluginSettings.ini, section[Lua]. For interfaces setLuaUIEnable=1and a 32 characterLuaUIScriptKey, which is the key your encrypted window scripts are packed with. -
Client side: nothing to patch by hand. Development mode is pushed by the server through
ClientDevModeandDevModeAccounts, so you name the accounts allowed to load plain scripts, use the F9 reload and open the debug console. - Tools: BitmapSlicer, IGC File Encrypt
Where to buy
- LuaAPI Core: https://www.igcn.mu/plugin-manager/plugin/23-luaapi-core/
- LuaUI Extension: https://www.igcn.mu/plugin-manager/plugin/26-luaui-extension/
Where to download tools
- BitmapSlicer: https://www.igcn.mu/files/file/167-bitmap-slicer/
- IGC File Encrypt: https://www.igcn.mu/files/file/157-igc-file-encrypt/
Where to start
Everything ships with the package. Server scripts live in Data\Plugins\LuaAPI, with the event handlers in Callbacks.lua and the type definitions under Defines. Client window scripts live in Data\Custom\Scripts\UI, next to a working Coin Exchange example you can read and copy from.
Switch the plugin on, open Callbacks.lua, and put a single line into one of the events to watch it fire. From there the pattern repeats: a handler, a condition, an action. Move on to the Extension when a feature deserves a window of its own instead of a chat message.
Full documentation: https://github.com/srv-config/Configs-Preview/wik