lua-users home
lua-l archive

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

On Wed, Jul 8, 2009 at 12:59 PM, Jerome Vuarand<> wrote:
> 2009/7/8  <>:
>> I wonder if there is a way to determine the "parent" lua_State
>> of a coroutine, given its own lua_State. In other words, I am
>> trying to find the lua_State a given coroutine has been created
>> from.
>> Is it possible ?
>> For the moment I am stuck.
> It is not possible. A coroutine "A" can create a coroutine "B", pass
> it to a coroutine "C", and terminate. "A" was the creator of "B", but
> it no longer exists. There is no coroutine ownership mechanism,
> coroutines are garbage collected objects like tables or functions.

the full creation tree isn't relevant; but knowing that all those
coroutines (or threads, from the C API) belong to the same lua_State
is quite valuable.