From: John L. <jla...@gm...> - 2005-12-22 19:36:57
|
> >This would be a good idea. I can make a very small demo, maybe just a > >single little class, like a subclassed button. > > > I would be really glad with that. If i understand you well, running a > lua script from within the application would display this button. And if > possible, when pressing the button a function in C++ calls a second lua > script. > What i am special interested in is how to call lua script from C++ > objects, and how to interface information back to lua. I understand this > is based on ConnectEvent(), and the event is bringing the C++ info to > the lua function. You're right, the button is too simple. I think a nice calculator program could be made. Something simple that shows both the C++ end and lua end. You can type things into the window and lua will run them as is and print out the answer, also the C++ side can run lua scripts to implement the buttons. > In the end i want to have a2dCanvasObject draw itself using a luascript. > And this will have its own eventhandler class and customevents and id's. > So i need to understand the mechanism, and how i can use it. > Anyway a sample explaining how to write your own bindings and how to use > them in an application is i think very welcome. I've been doing the simplest thing. I write little lua scripts and send them to wxLuaState::RunString. So, in C++ you get an event from a button or menu item and in the handler call RunString with the appropriate wxLua code. > But when i grep i still see wxLuaInterpreter. I am not yet at the level > of understanding those changes. > I saw wxLuaState all around, it seems you now use a class for the luasta= te. > Would it be possible you write a small introduction on how this all > works, and add it to the docs dir? wxLuaInterpreter is now gone, it's typedefed to the wxLuaState so it should be a seamless change. I am slowly adding some docs. > I am now trying to search the mailing list for this information, but > this is not so easy. > > What is your opinion on using Doxygen for documenting the code. Doxygen > always helps be to understand the structure of code, because it makes it > so easy to browse to almost anything right away. You can run doxygen in the docs dir using the doxygen.cfg file. Let me know if I set it up right, I don't fully understand some of the doxygen settings. > > The result of this seems to be > >that it's fairly straightforward to understand the inner workings now. > > > :-) I am sure you are making things much easier. > Still a small help on where to start, like the most important classes > and how they interact would be cool. > > Sorry for asking so much, i would prefer to help you instead, but first > i need to understand :-( The first thing to do is to walk yourself though the wxLuaState class. From the constructor to adding the bindings, and finally, pushing our print and error handlers into lua. Regards, John Labenski |