Basically what the title says. I know AS support pass value types by reference on parameters, but it is possible to define a reference to a value type in a method body? For example I've registered a C++ Vector2 as a value type, each operations returns a reference to itself for method chaining.
engine->RegisterObjectMethod("Vector2", "Vector2& add(const Vector2 &in)", asMETHODPR(Vector2, add, (Vector2&), Vector2&), asCALL_THISCALL);
engine->RegisterObjectMethod("Vector2", "Vector2& sub(const Vector2 &in)", asMETHODPR(Vector2, sub, (Vector2&), Vector2&), asCALL_THISCALL);
Then it can be possible to do in AngelScript the following? or should I register it as a reference type?
void main() {
Vector2 A(1,5);
Vector2 B(7,4);
Vector2& directionAB = B.sub(A);
}
Thanks in advance