On 2/7/07, John Labenski <[EMAIL PROTECTED]> wrote:
> I think the above should work. The easiest way to get the code above
> is to change your timer function in the *.i file to
> "timer(unsigned int msec, int exitflag)"
> and then run the generator. You now have code that is close to what you want.
>
> Note how we removed int* exitflag so that the generator works (it
> actually might even work with the *exitFlag, but I don't think it
> would compile since it'd be taking the address of a temporary since
> lua uses only double and the generator would cast the returned double
> from lua to a int. This is why I've used the wxPoint's int x member
> var.

For completeness here is the working and building override.

%override wxLua_timer_constructor
// %function timer(unsigned int msec, int* exitflag)
static int LUACALL wxLua_timer_constructor(lua_State *L)
{
    wxLuaState wxlState(L);

        // get the lua passed in parameters
        wxPoint* exitFlag = (wxPoint *)wxlState.GetUserDataType(2, 
s_wxluatag_wxPoint);
    unsigned int mSec = (unsigned int)wxlState.GetNumberType(1);

        timer* returns;

    // call timer constructor
    returns = new timer(mSec, &exitFlag->x, NULL);

        // let the lua garbage collector delete this when out of scope
    wxLua_AddTrackedObject(wxlState, (timer*)returns);

        // push the result datatype
    wxlState.PushUserDataType(s_wxluatag_timer, returns);

    // return the number of parameters
    return 1;
}
%end

I now have the library building. I now need to add it to the wxLua
solution and the I am now sure what I need to do to include this in a
full compiled version of wxLua.

Is there any initialization I need to call?

Oh.... Thanks so much for helping. I am moving slow, but you are
helping tendentiously.
-- 
Regards,
Ryan
RJP Computing

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier.
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
wxlua-users mailing list
wxlua-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wxlua-users

Reply via email to