lua-users home
lua-l archive

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


Hi,

Daniel Krenn wrote:
> ** Also, would anyone have any solid examples of coroutine
> implementation?

I'll make a first snapshot of my derivate of Lua that includes
coroutines in about 2 weeks.

> i.e. how to handle multiple (i.e. hundreds, maybe thousands) of
> independant characters in a persistant world which need to fully
> interact with one another? We're very new to scripting, and have
> had little luck trying to find help on this particular topic :(

I have to make some notes here.

My coroutine implementation is not system independent because it
uses C coroutines and these cannot be made with ANSI functions.

And about thousands of coroutines: that's where coroutines would
really shine.  Unfortunately, my implementation creates a fixed
stack for Lua and one for C for _each_ coroutine.  You can set
these sizes during coroutine creation but I would say, a total
of less than 4kByte/coroutine becomes ... hmm... dangerous *g*.
So, with thousands of them you get pretty heavy memory usage.

Ciao, ET.