Hacker News new | past | comments | ask | show | jobs | submit login

I had a similar revelation a few months ago when working on a little game in Lua.

Since a game runs as a loop, all synchronous code needs to be able to execute within one frame.

So you end up making overcomplicated state machines to represent processes that last for multiple frames.

Coroutines make writing this code sooooo much easier. You can actually start to see the logic again at a glance rather than having to dive into a big stateful mess.




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

Search: