lua-users home
lua-l archive

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


The current wxLua binding stores the current lua_State
pointer when creating some of the wxWidgets components,
so that it can do callbacks etc latter.

This causes problems if coroutines are used. When the
coroutine is terminated the related lua_State becomes
invalid, even if the main Lua program is still
running.

AFAIK there is no function in Lua API for finding
out the root lua_State from an lua_State. It looks like
it could be done by directly accessing the l_g->mainthread
member, but that is going to Lua internals, bypassing the API.

The root state could be used for fixing the wxLua problem
either by using it as the lua_State in the callbacks or
at least by failing cleanly attempts to create GUI elements
in the non root coroutines. The current situation
might lead to memory corruption errors which is
certainly worse than clean error message.

Maybe this kind of function could be added to the API?


		Eero