Retired
Plugin hot reload
A developer tool that reloaded individual plugins instead of the whole gamemode. It carried three months of feature work, then was retired.
- Role
- Design and implementation
- Stack
- Lua (GLua), NutScript internals
- Context
- Local development workflow
- Status
- Retired
The problem
Changing any gamemode file reloaded the entire gamemode, freezing my local server for about ten seconds every time I wanted to test something. Over a day of iteration, that adds up to a lot of waiting.
How it worked
- Plugins moved outside the gamemode folder, where the engine can refresh a single file on its own.
- A one-line guard at the top of each plugin file caught that refresh and reloaded the plugin set through my own loader instead.
- The loader mirrored the framework’s own: libraries, factions, classes, interface code, entities, weapons, effects, languages, sub-plugins and items.
- Plugin tables were reused across reloads, so state survived and event handlers were replaced rather than duplicated.
- After loading it replayed the framework’s start-up events, with an opt-out list for plugins that couldn’t handle running them twice.
- Profiling showed the spawn menu rebuild was a major lag source, so it was suppressed during reloads.
Code excerpt coming soon
The guard function and the reload entry point, with its re-entrancy checks.
assets/excerpts/hot-reload-guard.lua
What it carried
From March to June 2025 it was how I built most new features, including faction events, conflict locks, criminal stashes, gun bags, barricades, lockpicking and the first version of felonies.
Why it was retired
Its weakness was its footprint. Every hot-reloadable file needed that one-line guard, so a convenience for my own workflow became part of the codebase everyone else maintains. After a compatibility issue with one plugin that did unusual things at start-up, the owner and I agreed to retire it.
If I built it again, I’d make it invisible to the code itself: a development-only file watcher that reloads plugins from outside the gamemode, with nothing added to plugin files.