On the other hand, lua developers have more experience with coroutines than js developers, so I may be way off in my concerns. As always I love to see people experimenting!
On Thu, May 10, 2012 at 3:56 PM, Jorge
<xxopxe@gmail.com> wrote:
On mié, 2012-05-09 at 07:22 -0400, Rob Hoelz wrote:
> Basically, I want to create an event library for Lua that sits on top
> of another event library (luaevent for now, but I would probably make
> the system flexible enough for a different library should that be
> desired).
For completeness sake: https://github.com/xopxe/Lumen
It does not depend on a event library, but on a library that provides a
select or poll-like call. At the moment, luasocket and nixio are
supported. It's of the "cooperative, events&blocking, coroutine based,
calculating the timeout for a select" class.
The API looks like this:
---------------------------------------------------
local sched = require "sched"
local emitter_task=sched.run(function()
sched.catalog.register('A')
while true do
sched.signal('ev', 'data!')
sched.sleep(5)
end
end)
sched.run(function()
local waitd={emitter=emitter_task, events={'ev'}}
while true do
_, m = sched.wait(waitd)
print (m)
end
end)
sched.go()
---------------------------------------------------
Good luck in your quest :)
Jorge