There's also ConcurrentLua (http://concurrentlua.luaforge.net/), which is a more deliberate attempt to port Erlang-style concurrency to Lua. It doesn't have pattern matching for selective receive, IIRC, and doesn't enforce lack of local state, but is otherwise mostly there. It implements lightweight processes via Lua coroutines, which are cheap co-operative mini-threads, the other concurrency model that (IMHO) makes sense.
I've played with it a bit and it seems well-designed, but at the time I hadn't done much serious with Erlang, and felt it would make more sense to learn the Erlang idioms (supervisor trees, etc.) from Erlang itself and come back to ConcurrentLua later. I'm very interested in it, though - Lua is one of my favorite languages.
It also seems to be the work of one grad student, who since graduated (and may have moved on). OTOH, it's a rather small project, since Lua (as with Scheme and Termite) already provides most of the necessary infrastructure in the core language (it's mostly a scheduling wrapper for coroutines and some distribution primitives), so forking it wouldn't be terribly difficult.
I've checked out both concurrentlua and luaproc in the past and they seem quite similar (both use cooperative scheduling via co-routines). I initially liked luaproc more because the channel-based message passing approach in luaproc seems to me to be inherently more flexible than message passing based on process id's. luaproc leads to a particularly elegant implementation for the chameneos-redux benchmark, for example.
concurrentlua seems more maintained, though; it showed up on luaforge more than a year ago and its latest update was in May, which to me means that the creator is interested in continuing the project. I believe this is the paper that introduced concurrentlua:
Thanks! I was looking for the ConcurrentLua PDF - it isn't linked on the project site anymore.
IIRC, luaproc was put up on luaforge because people on the mailing list read the paper and started asking if the source was available.
There are also about a half dozen other concurrency packages for Lua, which at first seems rather odd. As a language, it has quite a few semi-official extensions, but unlike Scheme (with its standard and several implementations), it's because the language designers are very serious about keeping the core language small and portable for embedding. You can import the ~800k of source into your project tree and fork it as necessary, compile it down to a ~200k library, etc. In practice, this means that people contribute Lua extensions that help it can work nicely with whatever funky C++ game engine they're using, etc., as well as more general libraries.
" It doesn't have pattern matching for selective receive, IIRC"
So http://metalua.luaforge.net/ has an implementation of pattern matching as one of it's shipped examples. Do you know if ConcurrentLua could be used with pattern matching. or is it designed such that, as it stands, pm would be useless.
I don't think it does -- the receive function only takes a timeout[1]. If it did pattern matching, it'd probably take a table of potential patterns, or a table array of pattern->functions, or somesuch.
After wondering before, I just checked the source. In message.lua, receive just takes an optional timeout. It'd be easy to have it take an optional function argument that tests each message in turn (since it's just a list of messages, modified in place), and returns a true if that message should currently be used. I'll test and submit a patch for it later. Not as flexible as pattern matching, but PM would be better off in the base language. As for integrating Metalua's PM with selective receive, I'm not sure.
I've played with it a bit and it seems well-designed, but at the time I hadn't done much serious with Erlang, and felt it would make more sense to learn the Erlang idioms (supervisor trees, etc.) from Erlang itself and come back to ConcurrentLua later. I'm very interested in it, though - Lua is one of my favorite languages.
It also seems to be the work of one grad student, who since graduated (and may have moved on). OTOH, it's a rather small project, since Lua (as with Scheme and Termite) already provides most of the necessary infrastructure in the core language (it's mostly a scheduling wrapper for coroutines and some distribution primitives), so forking it wouldn't be terribly difficult.