Builtin Library
README.md
subscriptions
Runtime inspection and cancellation of component-event subscriptions.
Every external subscription made through a component's .events facade
(comp.events.onX:connect(fn)) is tracked with its origin — which component
or execute() call subscribed, and from which source line — plus delivery
counters and connected/cancelled state. Publishers are tracked per component
instance with per-event fire counts, including events nobody subscribes to.
local conn = comp.events.onScored:connect(function(p) print(p.points) end)
print(conn.id) -- "sub_7": the inspection id
subscriptions.get(conn.id) -- row: origin, deliveries, connected
subscriptions.list({ connected = true })-- all live subscriptions
subscriptions.publishers() -- who declares events + fire counts
subscriptions.cancel(conn.id) -- disconnect now, row marked cancelled
The same data is browsable in the VFS:
/zero/runtime/events/STATE summary counts
/zero/runtime/events/publishers/<iid>/meta.json per-event fire stats
/zero/runtime/events/subscriptions/<sid>/meta.json one subscription row
Rows for disconnected subscriptions (a :once that ran, a cancelled
connection) are retained — bounded — until their publisher instance is
destroyed, so "did it ever fire?" stays answerable after the fact.