Conversation
…shr). XOR is a bit awkward to use, since its operator is already abused for pow.
|
OK, compatibility with 5.2 and 5.1.... I suppose it's enough to make the tests conditional based on the lua version used, since having extra metatable entries shouldn't be an issue. Do you think there's a point in making the support conditional as well? |
Oberon00
left a comment
There was a problem hiding this comment.
Thank you very much for the contribution! I'm not really maintaining this repository anymore, but your change looks useful and low-risk enough that I think I'm going to merge it without testing it myself 😃 If you have time to add the additional test assertions (see comment), that would be even better, otherwise tell me if you prefer to merge it as-is.
| DOSTRING(L, "assert(~test == 'bitwise not operator')") | ||
| DOSTRING(L, "assert(test << test == 'left shift operator')") | ||
| DOSTRING(L, "assert(test >> test == 'right shift operator')") | ||
| #endif |
There was a problem hiding this comment.
Can you add a #else (or always-on) test that the metamethods with expected names are defined even if Lua does not interpret the names specifically?
Add support for Lua 5.3's bitwise operators (and, or, xor, not, shl, shr).
XOR is a bit awkward to use, since its operator is already abused for pow.
For example:
.def("__bxor", static_cast<std::string(*)(operator_tester const&, operator_tester const&)>(&operator^))