Skip to content




Function Name Usage Description Notes
New Vector2D Vector2D.New(number x, number y) Construct a new two dimensional Vector2D with the given x and y components.
Normalize Vector2D vec:Normalize()
Length number vec:Length()
SquaredLength number vec:SquaredLength()
Distance number Vector2D.Distance(Vector2D vec1, Vector2D vec2)
SquaredDistance number Vector2D.SquaredDistance(Vector2D vec1, Vector2D vec2)
Dot number Vector2D.Dot(Vector2D vec1, Vector2D vec2)
Lerp Vector2D Vector2D.Lerp(Vector2D vec1, Vector2D vec2, number alpha)
Abs Vector2D vec:Abs()
Ceil Vector2D vec:Ceil()
Floor Vector2D vec:Floor()


Parameter Name Usage Description Notes
x float x X component of 2D vector
y float y Y component of 2D vector


Constant Name Usage Description Notes
Zero Vector Vector2D.Zero Zero vector (0, 0)


Override Name Usage Description Notes
new_index vector2D.var = object value
addition operator +
subtraction operator -
unary_minus unary_minus
multiplication operator *
division operator /
to_string string tostring(Vector2D var)