On 7/15/05, Francesco Montorsi <f18...@ya...> wrote:
> Hi,
> I was revising all my components at wxCode and looking at wxScript I
> was wondering: I know that wxLua provides wrappers for all
> wxWidgets-stuff; i.e. to create apps written in LUA based on wx; but if
> I'm not interested in this but just in using wxLua from a c++ program as
> a script interpreter, can I still use wxLua ?
wxLua currently loads the wxWidgets wrappers by default. However, this
will change so that you can use wxLua as a straight lua interpreter.
We are waiting for a new wrapper mechanism that promises to be more
flexible. Hopefully, soonish.
=20
> My wxScript component actually supports lua, python (more or less, also
> cint & underc) but it's rather difficult to provide a reliable interface
> to multiple script interpreters, specially because some of these (underc
> and cint) are unstable and python gives me some leaks when used from a
> c++ app...
I would have loved to have used wxPython, but after struggling for a
year or so with it, I gave up trying to use it as an embedded C++
interpreter. The problems I had sound similiar to yours, memory leaks
and what not. I believe that python itself is not well suited to
embedding. IIRC, it supports only a single instance at a time, you can
play games to get more, but it was touchy since they're not true
independent interpreters. I don't remember much anymore, but something
about it's memory management made it interact poorly with your own C++
code.
> In the end I'd like to use only lua as script interpreter and I wonder
> if wxLua lets me to use lua in such way.
> When loading a script I need to know which functions are defined in the
> script file, what's their name & I need to be able to call them and
> exchange data using parameters... can I do that with wxLua ?
This is possible, but the API for it is not unified yet. I hope to
write a wxLuaState class that throws together all the little c
functions to make manipulating the lua_State from C++ very easy.
Something along the lines of LuaPlus, but a lot simplier. Currently
the wxLuaInterface will build a list of functions in lua for you.
It's just a matter of getting the new wrappers going and then putting
it all together in a way that would make it easier to use in a C++
program.
I hope this helps,
John Labenski
|