▣
module · drop-in viewer
asset⌬ modulemoduleprimary: init.luau·part ofpackage pursuitKit.package·originates fromworld 0a0b119f-a…
hub
A small event hub: named events, plain payload tables, no engine.
by·posted 11d ago
What it does
hub
A small event hub: named events, plain payload tables, no engine.
Every pursuitKit system reports what happened through a hub the host passes in, so animation, camera, sound and
UI subscribe to moments instead of polling state.
local Hub = require("~.modules.hub")
local hub = Hub.new()
local off = hub:on("state", function(e) print(e.from, e.to) end)
hub:emit("state", { from = "clear", to = "noticed" })
off() -- disconnect
hub:onAny(function(name, e) ... end) -- every event (a log, a recorder, a test)
A handler that errors does not stop the others; its message is kept in hub.lastError.
The interface is documented in the header of init.luau; this file repeats it for the asset browser.
Discussion
Scoped to this part · feeds back into the world's score.
Sign in to post.sign in
No comments yet. Be the first.