hump
hump copied to clipboard
[hump.signal] stopping signal propagation
Would be great to have a way to stop the signal propagation:
function Registry:emit(s, ...)
for f in pairs(self[s]) do
if f(...) == false then return end
end
end
so we could stop the signal using:
Signal.register('mousepressed', function(x, y)
...
return false
end)
Since pairs can iterate in any order, this would be non-deterministic. Would that be acceptable?
That's true, maybe not a good idea. Anyway, I patched emit on my project and it does the job for now.
Do you think of another way to stop the signal without patching the lib?