vector

v0.0.6
createVector(x, y);

Create a vector instance

Arguments

xThe first component of the vector
yThe second component of the vector

Returns

VectorThe created vector

 local a = createVector(3, 5);
 local b = createVector(1, 3);
 
 local c = a:add(b);
 
 print(c);

Vector.print();

Since a Vector implements a print method, it can be used in the print function

 local a = createVector(3, 5);
 
 -- With print
 print(a);

 -- With class method
 Vector.print(a);

 -- with instance
 a:print();

Vector.mult(a, b);

No description

Arguments

aThe first vector
bThe second vector

Returns

VectorThe added vector

 local a = createVector(3, 5);
 local b = createVector(1, 3);
 
 print(a:mult(b));
 print(Vector.mult(a, b));

Vector.add(a, b);

No description

Arguments

aThe first vector
bThe second vector

Returns

VectorThe multiplied vector

 local a = createVector(1, 4);
 local b = createVector(8, 2);
 
 print(a:add(b));
 print(Vector.add(a, b));