Develop 1.8 #20

Merged
Kan18 merged 242 commits from develop-1.8 into master-1.8 2019-11-10 20:52:08 -05:00
Showing only changes of commit 496e95a6c4 - Show all commits

View File

@@ -243,6 +243,21 @@ local function processRoutines(...)
end
end
-- invoke the handlers registered for this event
function Event.trigger(event, ...)
local handlers = Event.types[event]
if handlers then
for _,h in pairs(handlers) do
if not h.co then
-- callbacks are single threaded (only 1 co per handler)
h.co = createCoroutine(h)
Event.routines[h.uid] = h
h:resume(event, ...)
end
end
end
end
function Event.processEvent(e)
processHandlers(e[1])
processRoutines(table.unpack(e))