lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


Hi

2011/2/18 Javier Guerra Giraldez <javier@guerrag.com>:
> On Thu, Feb 17, 2011 at 8:23 PM, Andrew Yourtchenko <ayourtch@gmail.com> wrote:
>> I thought of naming it "node.lua" but figured it's a bit too early ;-)
>
> IMHO, a big part of the hype around node.js is that everybody
> discovered that a callback-heavy framework is usable when you have
> clean anonymous functions; but the downside that everybody suffers is
> the lack of linearity in the code.  what most don't realize is that
> it's because of the lack of coroutines or continuations.
>
> a Lua async implementation using coroutines would get the same
> advantages without all the pain.  that would make such a project
> distinctively 'un-node'

I've actually just written something along those lines. I mostly wrote it to
do quick Lua hacks to listen to a serial port or bluetooth while answering
network requests, but it is quite general and can be used for a variety
purposes I guess. It's designed so that all the exciting bits of code are
in special modules which hook into the global main loop, so you can mix and
match whatever functionality you need and easily extend it.
I have curl and postgres plugins in the works too.

It's still early days, but it worked out quite well IMHO and is quite fun
to use, so I thought I'd share. I call it a Lua Event Machine, and it can
be found at

https://github.com/esmil/lem

..and you'd most likely also want the stream module at

https://github.com/esmil/lem-streams

DISCLAIMER: It's mostly tested on Linux, but I've run it on FreeBSD too.
It should work on other POSIX platforms too, but not on Windows, sorry.

/Emil