[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Multithreaded Lua
- From: GrayFace <sergroj@...>
- Date: Tue, 20 Jul 2010 10:45:55 +0700
Here's roughly the way I do it:
local event_coroutines = {}
function event_triggered(...) -- called when an event is triggered
local co = event_coroutines
event_coroutines = {}
for i = 1, #co do
coroutine.resume(co[i], ...)
end
end
function event_wait()
event_coroutines[#event_coroutines + 1] = assert(coroutine.running())
return coroutine.yield()
end