On Tue, May 22, 2012 at 11:58 AM, Sven Andersson <m...@svenandersson.se> wrote:
>
> However, I have a quick question regarding how to use it;
> Would it be possible to link the lib statically, and register the wxWidgets
> functionality/bindings directly to my already existing lua_State object?

Yes.

See enum wxLuaState_Type and
wxLuaState(lua_State* L, int state_type = wxLUASTATE_GETSTATE)

use wxLUASTATE_SETSTATE|wxLUASTATE_STATICSTATE|wxLUASTATE_OPENBINDINGS
and don't close the lua_State before destroying the wxLuaState.

http://wxlua.svn.sourceforge.net/viewvc/wxlua/trunk/wxLua/modules/wxlua/include/wxlstate.h?revision=81&view=markup

> I would preferably want to distribute my application as one binary, and it
> would be awesome to have wxLua already linked and available in the Lua state
> (since all the application scripts and data also have been "merged" into the
> binary).

See the app wxLuaFreeze, this is a very basic implementation of this
concept where it simply tries to read a Lua script from the end of the
executable that has been attached to it.

I recommend that you start from something like wxLuaFreeze instead of
creating the lua_State yourself and then attaching the wxLuaState to
it. You need to get the wxWidgets event loop initialized and the
best/easiest way to do it is with a wxApp derived class instead of a
main(). Otherwise you have to start it by hand in your main()
following the code in modules/luamodule/src which I do not recommend.

Note that the printing output of wxLuaFreeze is terrible in MSW and
will be switched to how the wxLua app does it using stdout in MSW.

Regards,
    John

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
wxlua-users mailing list
wxlua-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wxlua-users

Reply via email to