John Labenski wrote:
> I don't know why, didn't it generate something like this?
>
> %operator double operator-( int col, int row )
>
> double returns = ((*self)-(col, row));
>
> Anyway, it should be fixed in CVS.
>   
I updated, and now get errors.

http://www.velocityreviews.com/forums/t291623-why-overload-operator-as-friend-.html

So the friend keyword is needed in C++. And there or two ways to 
write/reach the same thing with operator==.
Operators with 2 args, need the friend word to reach the private members.
In principle it is a function which is not part of the class, but 
declared inside it.
In any case if you generate the next (after the word WRONG), all is fine.

%class %noclassinfo  %encapsulate a2dAffineMatrix

    %operator bool operator== ( const a2dAffineMatrix& a, const 
a2dAffineMatrix& b )

Should become:
   
    static int LUACALL wxLua_a2dAffineMatrix_op_eq(lua_State *L)
{
    // const a2dAffineMatrix b
    const a2dAffineMatrix * b = (const a2dAffineMatrix 
*)wxluaT_getuserdatatype(L, 3, wxluatype_a2dAffineMatrix);
    // const a2dAffineMatrix a
    const a2dAffineMatrix * a = (const a2dAffineMatrix 
*)wxluaT_getuserdatatype(L, 2, wxluatype_a2dAffineMatrix);
    // get this
    a2dAffineMatrix * self = (a2dAffineMatrix 
*)wxluaT_getuserdatatype(L, 1, wxluatype_a2dAffineMatrix);
    // call op_eq
    // WRONG bool returns = ((*self)(*a, *b));
    bool returns = *a == *b;
    // push the result flag
    lua_pushboolean(L, returns);

    return 1;
}



-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
wxlua-users mailing list
wxlua-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wxlua-users

Reply via email to