Builtin Library
README.md
probe.onCall
Fire when a named function runs, and see both what went in and what came out.
path is a module identity and a field on it — modules.combat.applyDamage.
The probe replaces that field with a wrapper that calls through, so it follows
the function rather than the file, and a caller reaching it by any route is
seen. Cancelling puts the original back.
The context carries args (a list, in order) and ret (the first returned
value), so "it fired and produced this" is one condition rather than a filter
written inside the body.
probe.onCall("modules.combat.applyDamage", {
notice = "a hit killed something",
when = "ret.killed",
run = "return ret.target .. ' at ' .. tostring(ret.hp) .. 'hp'",
})
The call always happens. The probe observes it and never decides whether it runs, so a body that throws cannot take the program with it.
A function that is not a field on a required module — a local inside a module,
a helper a component keeps to itself — cannot be named this way; use onLine.
Globals are sealed read-only and cannot be wrapped at all.