hump icon indicating copy to clipboard operation
hump copied to clipboard

[hump.signal] stopping signal propagation

Open pcornier opened this issue 7 years ago • 2 comments

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)

pcornier avatar May 03 '18 14:05 pcornier

Since pairs can iterate in any order, this would be non-deterministic. Would that be acceptable?

vrld avatar May 05 '18 11:05 vrld

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?

pcornier avatar May 05 '18 18:05 pcornier