From: k. h. <kla...@nl...> - 2006-02-06 09:00:22
|
Hi John, John Labenski wrote: >You can have your C function just call lua code directly. >m_wxlState.RunString(wxString::Format(wxT("hittest(%f, %f)"), x, y))); >in the lua code you can then set variables back to C++ through the binding. > > But i need to call a function in Lua which gets as a parameter a wxDC pointer from C++. So i think i need to push things on the lua stack, and call a function next? Also the functions to call are part of the m_script string stored inside each luacanvas object. And for each such object that script would be different in general, but the function is called the same ( Draw and HitTest ). Just reporting the functions to lua (using runstring() ) is not enough, as i think they must be unique. But on the other hand wrapping the luacanvas object to lua does not help too, since the instance of the object is in the C++ canvas. So i do not want to create the instance inside lua code. Eventually i think i need to push the current (to draw/hit ) luacanvas object as a (this) pointer on the stack, and next the parameters to the member function to call on that object. And when that is ready call the function. How complex :-( If you have any idea, i be glad to hear them, regards, Klaas -- Unclassified |