Coroutine are a powerful low-level tool to build higher level, user friendly environments. That's true of most of Lua's advanced features, BTW: they tend to be complex tools letting you build simple-to-use stuff (as opposed e.g. to C++'s templates, where you need a fairly advanced understanding of C++ metaprogramming features to use even simple containers correctly).
Anyway, coroutines are intended to let people build their own high-level concurrency system. It's used e.g. to share the CPU among scripted entities in video games.
Mihini (http://www.eclipse.org/mihini/) offers higher-level concurrency within a single OS thread, primarily targetting Linux-based embedded communicating applications.
Copas (https://github.com/keplerproject/copas) is much simpler, but probably sufficient if you only need to handle several sockets concurrently without wasting many OS threads.
There are also some attempts to wrap luvit (https://github.com/luvit/luvit), Lua's porting of libuv, with coroutines, getting callback-based performances without it's tendency to make one's code write-only. I don't know what's usable and maintained, nor even whether it really exists.
Anyway, coroutines are intended to let people build their own high-level concurrency system. It's used e.g. to share the CPU among scripted entities in video games.
Mihini (http://www.eclipse.org/mihini/) offers higher-level concurrency within a single OS thread, primarily targetting Linux-based embedded communicating applications.
Copas (https://github.com/keplerproject/copas) is much simpler, but probably sufficient if you only need to handle several sockets concurrently without wasting many OS threads.
There are also some attempts to wrap luvit (https://github.com/luvit/luvit), Lua's porting of libuv, with coroutines, getting callback-based performances without it's tendency to make one's code write-only. I don't know what's usable and maintained, nor even whether it really exists.