Hacker News new | past | comments | ask | show | jobs | submit | more raksoras's comments login

Coroutines are much better suited to event driven, non blocking IO code. Sorry for the shameless plug but I recently released my hobby project that uses Lua coroutines for nonblocking HTTP server: https://github.com/raksoras/luaw

Lua was quite pleasant to work with in this context!


Agreed, but Node has had co-routines in the form of the node-fibers package since almost the very beginning.


Sorry for the shameless plug but I just released HTTP server based on Lua coroutines (https://github.com/raksoras/luaw) that pretty much follows the exact design from the OP article.


This is pretty cool. Thanks for sharing.


Event driven, non blocking HTTP app server for Lua inspired by Node.js. Uses Lua coroutines in place of nested callbacks to simplify application code.


Looks good at first glance but could you explain how this differs from https://github.com/luvit/luvit and similar projects?


Luvit is an impressive project. However, as far as I can tell they still use Node.js style callbacks to handle asynchronous processing. IMHO Lua's coroutines are a natural match for event driven, async code and easier to use than nested callbacks. There are no callbacks in Luaw which makes writing nonblocking codes essentially as straight forward as blocking code. You never explicitly create coroutines or manage them in your code. Luaw automatically suspends HTTP request running in its own coroutine whenever read/write call is about to block and resumes it when the socket is ready for read/write


Its a few years behind luvit and is much more difficult to build.


Consider applying for YC's Spring batch! Applications are open till Feb 11.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: