LSL Wiki Mirror 10-5-2006: DotOperator

HomePage :: PageIndex :: RecentChanges :: RecentlyCommented :: UserSettings ::
The dot operator (.) is used to access individual members of structures. LSL only supports two types of structures: vector and rotation.

rotation a;
a.x = 0.0;

if you were to write them as classes in C++ it would look something like this
class rotation
{
  public:
    float x,y,z,s;
    rotation(void);
    rotation operator * (const rotation & q);
    rotation operator / (const rotation & q);
    list operator + (const list & q);
    rotation & operator *= (const rotation & q){this = this * q; return this;};
    rotation & operator /= (const rotation & q){this = this / q; return this;};
};

class vector
{
  public:
    float x,y,z;
    vector(void);
    vector operator + (const vector & q);
    vector operator - (const vector & q);
    vector operator % (const vector & q);
    vector operator * (const rotation & q);
    vector operator / (const rotation & q);
    vector operator * (const float & q);
    vector operator / (const float & q);
    vector operator * (const integer & q);
    vector operator / (const integer & q);
    list operator + (const LSLList & q);
    vector & operator += (const vector & q){this = this + q; return this;};
    vector & operator -= (const vector & q){this = this - q; return this;};
    vector & operator %= (const vector & q){this = this % q; return this;};
    vector & operator *= (const rotation & q){this = this * q; return this;};
    vector & operator /= (const rotation & q){this = this / q; return this;};
    vector & operator *= (const float & q){this = this * q; return this;};
    vector & operator /= (const float & q){this = this / q; return this;};
    vector & operator *= (const integer & q){this = this * q; return this;};
    vector & operator /= (const integer & q){this = this / q; return this;};
};
There is no comment on this page. [Display comments/form]