lua-users home
lua-l archive

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


if I've this code:

lua_State* pParent = luaL_newstate();
lua_State* pChild = lua_newthread(parent);

It seems like the last command also destroys the parent VM (all access to it after the call to lua_close results in access to non allocated memory).

So given the code above: Is there any difference between calling lua_close() on pChild or on pParent? I know that I've not to call lua_close(pChild); to cleanup anything, because coroutines are subject to GC. I'm just asking to get better understanding of inner mechanics.

Thank you and regards