I'm setting up a class as a value type using "asOBJ_VALUE | asOBJ_POD | asGetTypeTraits<Obj>()" flags in the registerobjecttype function. I've set up the object properties, methods, override methods and the operators. However, some operators for this object type are global and take the two parameters. I'm trying to register them as global functions with this (C++ operator prototype is beneath too:
RegisterGlobalFunction("const Obj opMul(const Obj &in, const Obj &in)",
asFUNCTIONPR(operator*, (const Obj&, const Obj&), const Obj, asCALL_CDECL);
const Obj operator * (const Obj &a, const Obj &b);
And while I'm not getting any syntax errors, and that it appears to register without errors, it doesn't work in script:
QuoteNo matching operator that takes the types 'Obj' and 'Obj' found
These 'global;' operators are for the "val * val" and the member operators use the assignment "*=". Also, I had to add the "asGetTypeTraits<Obj>()" flag so I can use the return by value that the global operator uses.