lua-users home
lua-l archive

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

Another suggestion is to keep a table with week keys in the coroutines
parent state and have userdata with a custom __gc as the values.  When
the coroutines get collected, so will the userdata.


On 5/12/07, Shmuel Zeigerman <> wrote:
Graham Wakefield wrote:
> This won't work.  The registry is shared between the main state and all
> child states created within it.

You're right. I wrongly assumed that each coroutine had its
own registry. Thanks for pointing that out!

Then, Rici's advice is probably the best.

There is (at least) one more way to achieve that goal: create
a userdata with a __gc method and put it on the coroutine's
stack (say, as the 1-st parameter to the coroutine's main function).
(Tested today, and seems to work).