Based on the samples/event-emitters.lua:

local Emitter = require('core').Emitter

local emitter = Emitter:new()

emitter:on("foo", function (...)
  p("on_foo", ...)
end)

emitter:once("foo", function (...)
  p("on_foo2", ...)
end)

--add on_foo3 here
emitter:on("foo", function (...)
  p("on_foo3", ...)
end)

p(emitter)

emitter:emit("foo", 1, 2, 3)
emitter:emit("foo", 4, 5, 6)

and the result is:

"on_foo"        1       2       3
"on_foo2"       1       2       3
"on_foo3"       1       2       3
"on_foo"        4       5       6


the on_foo3 is not called.

-- 
You received this message because you are subscribed to the Google Groups 
"luvit" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to