On Sat, May 1, 2010 at 6:23 PM, Ivan Drago <ne...@yahoo.com> wrote: > Another question - how to integrate wxLua into existing C++ wxWidgets > application (for ex. Kicad) ? Is there somewhere the examples of such > integration ? >
I have some personal projects that use wxLua in a C++ app, but I'm not sure of any common public app that uses it. However, there's no magic to it. wxLua code can operate on the C++ app's objects using wxGetApp(), wxFindWindowByName(), FindId(), etc. You can write a little Lua script that is run in the wxLuaState to present these windows to the user's script or hide them as appropriate. You can also provide a set of your own wrappers for Kicad's libraries (see wxLuaCan sample), that allow wxLua to access/create your classes. I'm not sure how you will be using wxLua, but the best way to think about it is that wxLua code is run in the main thread (GUI code has to be in main thread), just like C++ code, and is indistinguishable from it. (Use Lua debug hooks to catch runaway scripts) However, if this is for end users, you may want to provide a set a simplified Lua functions that hide dangerous things and simplify tasks. You can mess with the C++ app from Lua in the wxLuaEdit sample program using wxGetApp etc... In fact, wxLuaEdit/wxStEdit is designed to be used as an embedded script editor in a C++ program, but since it's a developer's tool no effort was made to do any sandboxing. See the code below to see how the scripts are run, search for ID_WXLUAIDE_RUN_LUA which is the "Run" button. http://wxlua.cvs.sourceforge.net/viewvc/wxlua/wxLua/apps/wxluaedit/src/wxledit.cpp?revision=1.37&view=markup Regards, John
------------------------------------------------------------------------------
_______________________________________________ wxlua-users mailing list wxlua-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wxlua-users