Hot reload
Save a file and your mod reloads in the running game.
Save a .lua file of your mod. A moment later, Wax reloads that mod. The game keeps running.
No other program has to run for this. Wax watches your mod's files from inside the game.
What a reload does
- Wax removes everything the mod made: windows, overlays, hotkeys, tasks and signal connections.
- Wax runs
init.luaagain, from the top.
After a reload your mod is in the same state as after a new start. Local variables start again too.
Mods that depend on the reloaded mod reload after it.
Keep a value across reloads
Use persist for values that should live through a reload.
local state = persist("state", { loads = 0 })
state.loads = state.loads + 1
local window = ui.Window({ title = "Reload counter" })
window:Field("Times loaded", state.loads)Save the file a few times. The number goes up each time.
persist("state", { loads = 0 }) gives back the same table on every reload. The second value is only used
the first time. Change what is inside the table. Don't replace the table.
persist forgets everything when the game closes. To keep settings between game sessions, use
storage.
When a reload fails
There are two ways a save can go wrong.
The file does not compile. This happens when you save in the middle of a line, or when your editor saves by itself while you type. Wax leaves the mod as it is: the version from before that save keeps running. The mod's card on the Mods page says which line is wrong. It is not counted as an error.
The file compiles but fails when it runs. The mod does not load.
- A red notification shows the error.
- The Mods page marks the mod as failed and shows the error under its name.
Either way, fix the file and save. Wax tries again by itself. Once the mod loads, its old errors are cleared from the panel.
New mods start switched off
Wax remembers which mods you have seen. A mod folder it has not seen before is listed switched off. Open the Mods page and flip its Enabled switch to load it.
This is so whether the folder was added while the game ran or while it was closed. A mod is code, and nothing that lands in the mods folder should run before you have had a look at it.
A mod you switched on stays on. It loads by itself the next time the game starts.
When a folder is added while the game is running, a notification tells you. Wax looks for new mod folders when you open the menu. While the Mods page is showing it looks again every couple of seconds. The refresh button beside the search box makes it look at once.
Reload by hand
Each mod on the Mods page has a Reload button. Use it to start the mod again without changing a file.
Switch a mod off
Flip a mod's Enabled switch off. The mod unloads and everything it made is removed. It stays off the next time you start the game, until you switch it on again.

Good habits
- Build your interface at the top level of
init.lua. Then it is rebuilt on every reload. - Don't keep game objects in
persist. They can be gone by the time you use them, for example after a map change. Get them again fromgame. - Remove a mod's folder to remove the mod. Wax unloads it the next time it looks.