On Wed, Sep 19, 2012 at 3:22 AM, Victor Bombi <son...@telefonica.net> wrote:
>> Can you change it to this and see if you can load it multiple times as
>> you used to?
>
> I have never been able to do it:

That make a lot more sense, I misunderstood you.

> My problem is that lualanes creates a
> completely new lua_State running in a separate thread
>  and a call to require on wx makes luaopen_wx return lua_getglobal(newState,
> "wx"); which is nil in
> that new lua_State.
>  The other part in luaopen_wx is not called
> because s_wxlState is a static wxLuaState  so !s_wxlState.Ok() fails because
> is was inited in a pevious lane (lua_State)
> So I can require it in ANY lane I want but only on ONE.

Ok, so there is hope... The problem is that LuaLanes creates
lua_States and when you call require("wx") wxLua needs to be installed
into them, but the catch is that the wxLuaState needs to live
somewhere for the life of the lua_State and be destroyed afterwards so
they don't collect as a memory leak.

The big question is: Can wxLua know when the LuaLane created lua_State
is destroyed so that the associated wxLuaState can be destroyed too?

If so, a static list of wxLuaStates can be made and when LuaLanes
creates a lua_State and require("wx") is called a new wxLuaState is
added and installed into the state and when the lua_State is closed by
LuaLanes the associated wxLuaState can be destroyed and removed from
the list.

Regards,
    John

------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://ad.doubleclick.net/clk;258768047;13503038;j?
http://info.appdynamics.com/FreeJavaPerformanceDownload.html
_______________________________________________
wxlua-users mailing list
wxlua-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wxlua-users

Reply via email to