reload_code
Hot-reload a Lua file into a running LÖVE game to apply code changes without restarting, clearing require() cache and re-running the file.
Instructions
Hot-reload a Lua file from disk into the running game (default 'main.lua'). LÖVE does NOT pick up file edits on its own — without this tool, changes you write to disk have zero effect until the game is restarted. This clears the require() cache for every game module first (so edits to files required by main.lua are picked up too, not just main.lua itself), then re-runs the file and calls love.load() again — it behaves like restarting the level with the new code rather than a state-preserving patch. Module tables themselves are reloaded via in-place mutation (same table identity, new contents), so any other system that already did local X = require(...) and kept that reference will see the updated code automatically — you do NOT need to manually re-point those. This does NOT apply to instances created from a module before the reload (e.g. an object made with Class.new()) — those keep their old field values and identity; if something else is holding a reference to a specific pre-reload instance, use run_lua to re-point it manually, or design around ids/lookup tables instead of raw instance references.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| file | No | Path relative to the game's source folder. Defaults to 'main.lua'. |