On 2/6/06, k. holwerda <[EMAIL PROTECTED]> wrote:
> 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?

Take a look at this, it tells you how to call lua functions from C.
http://www.lua.org/pil/25.2.html

> 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.

So you'll have a wxLuaState for every object? Maybe you can just
create a table in lua to store each object (as a sub table). In each
object's table you can put the functions to call.

> 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.

Humm, I don't think I understand. I haven't looked at the code for
wxluacan yet however.

-John


-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid3432&bid#0486&dat1642
_______________________________________________
Wxlua-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/wxlua-users

Reply via email to