Bus
One armed set of listeners on the shared event bus, for the staging slice.
staging.Bus
One armed set of listeners on the shared event bus, for the staging slice.
local Bus = require("staging.Bus")
Bus.arm({ plateCleared = function(n) ... end, sealed = function() ... end })
Bus.disarm()
Bus.count() -- how many are armed right now
A component's init.luau is re-executed on every hot reload, and the reload
does not fire onDestroy: the previous chunk's module-level locals come back
empty while its closures are still subscribed. Left alone, the staging director
would end up with two of every listener after two edits, and a plate going clean
would play its beat twice.
Holding the subscriptions here fixes that. This module is edited far less often
than the director it serves, so its state survives the director's reloads, and
arm drops whatever it was holding before it takes the new set.
Scoped to this part · feeds back into the world's score.