lua-users home
lua-l archive

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


On 01.02.2013 21:33, Peter Slížik wrote:
> Hi,
> 
> recently, I spent quite a lot of time studying various internet
> resources on coroutines, continuations, and other related topics.
> There's one thing that many authors hinted upon repeatedly, but nobody
> cared enough to give any particulars. They unanimously wrote that Lua
> coroutines are often used to implement the behavior of character in
> computer games.

You need a coroutine scheduler, which will "magically" manage them for
you. Check out lua-sched or lumen:

https://github.com/SierraWireless/luasched
https://github.com/xopxe/Lumen

> I have quite a hard time imagining a concrete implementation. Is
> somebody on this list familiar with this topic enough to give a few
> pointers, book references, or an example maybe?

Here is a simple working example for love2d:
http://love2d.org/forums/viewtopic.php?f=5&t=14166

Regards,
miko