Clone this wiki locally
Welcome to the Windower Lua wiki!
Windower now features Lua integration, allowing anyone to write scripts and addons. Lua is a powerful embeddable scripting language and is exposed in two different ways within Windower:
Scripts: Scripts act like the
.txtfiles currently run via
//exec, with the exception that they can use logic and flow control in their execution. For example, you can now write a script that will check your party for the lowest health target and issue a cure command.
Addons: Addons are Lua scripts that are loaded and stay loaded indefinitely (or until unloaded by the user). They respond to commands or events, and indeed use the same callbacks that plugins do for handling these things. What this means is that anyone can now write an addon to do basically anything you want.
First of all, you will need to familiarize yourself with Lua and how to get your project running. Arcon has put together a great guide for programmers who are switching over to Lua which can be found here: A Windower/Lua Guide for Programmers. For a more broad introduction to Lua, consider reading a Lua Tutorial and the Lua Reference Manual .
Next you'll want to try and get some code running! There are lots of examples to get ideas from in the source repository. A Windower-specific addon guide can be found here, which introduces how plugins should be created and what tools are available for addon developers.
Using Lua Scripts
Lua scripts are similar to the files that are currently run via the
//exec windower command. Instead of just executing commands, though, Lua scripts are capable of their own logic and decision making. Once a Lua script finishes running, it is unloaded.
You can run lua scripts via the
//lua exec command. For example, if you have a Lua script named scripts/test.lua, you would run it by typing:
//lua exec test
//lua e test
As implied above, these files belong in the
Using Lua Addons
Lua addons are similar to Windower Plugins, in that they are loaded once and continue to remain active, acting upon events and commands.
You can load Lua addons via the
//lua load command, similar to plugins. For example, if you had an addon named
addons/test/test.lua, you would load it by typing:
//lua load test
//lua l test
These files live within the
Windower4/addons directory. Each addon needs a directory corresponding to its name which should also include a readme describing your module.
LuaCore API Documentation
Events are functions declared in an addon that are automatically called by Windower in response to changing game conditions. To use them, simply add the appropriate event to your addon Lua file.
Interface Functions are functions that lua scripts and addons can call to interact with Windower. No special action is required to use these functions, they are callable from any script or addon at all times.
Game IDs are integer ID codes used by the game internally. Many events use these to transmit data, and this page provides a reference.