I've added the %operator tag to the bindings, just for wxPoint for
now. Since lua has only a limited subset of operators (no +=, ++, etc)
I've just made them into functions, which even if we wanted to
override the lua operators in the metatable we'd still use the
functions.
They take the same semantics as C++ class operator functions, just
prepend %operator to it.
operators["="] = "op_assign"
operators["=="] = "op_eq"
operators["!="] = "op_ne"
operators["<"] = "op_lt"
operators[">"] = "op_gt"
operators["<="] = "op_le"
operators[">="] = "op_ge"
operators["|"] = "op_or"
operators["&"] = "op_and"
operators["||"] = "op_lor"
operators["&&"] = "op_land"
operators["!"] = "op_not"
operators["++"] = "op_inc"
operators["--"] = "op_dec"
operators["+"] = "op_add"
operators["-"] = "op_sub"
operators["*"] = "op_mul"
operators["/"] = "op_div"
operators["+="] = "op_add_eq"
operators["-="] = "op_sub_eq"
operators["*="] = "op_mul_eq"
operators["/="] = "op_div_sub"
operators["%="] = "op_mod_sub"
operators["&="] = "op_and_eq"
operators["|="] = "op_or_eq"
operators["^="] = "op_xor_eq"
For example:
a = wx.wxPoint(1,2)
b = wx.wxPoint(1,2)
print(a:op_eq(b))
b = wx.wxPoint(1,3)
print(a:op_eq(b))
c = wx.wxSize(3,3)
d = b:op_add_eq(c)
print(d:GetX(), d:GetY())
true
false
4, 6
Regards,
John Labenski
-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid0944&bid$1720&dat1642
_______________________________________________
Wxlua-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/wxlua-users