[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: lua_newthread
- From: Mike Pall <mikelu-0509@...>
- Date: Thu, 1 Sep 2005 19:43:17 +0200
Brent Arias wrote:
> I keep creating new coroutines with lua_newthread, and each time I do, I
> notice lua_gettop is incrementing by one. Am I supposed to be immediately
> popping them from the stack when I create them? Or am I supposed to leave
> them there (until their life is over)?
You can either leave them on the stack (if you only have
a fixed number of them) or you can store them in a table
(if you have lots of them).
Popping them but still using them afterwards will screw up
the garbage collector.
> Why does lua assume to automatically put new threads I create onto the stack
> for me?