Skip to main content

vec2

This class represents a two dimensional vector (x and y). It is often used to represent 2D screen coordinates.

Constructor: vec2(x, y)

Use this constructor to create new vec2 instances.

local myVec = vec2(5, 2)

Properties

vec2 has two properties: x and y.

Example:

local myVec = vec2(5, 2)
print(myVec.x) -- Prints 5
print(myVec.y) -- Prints 2