vector.pack

Edit

Packs numbers into a vector.



Arguments

NameTypeDefaultDescription
xnumber The x component of the vector.
ynumber The y component of the vector.
znumber0 The z component of the vector.

Returns

NameTypeDescription
vvector The new vector.

Arguments

NameTypeDescription
nnumber A number to assign to the x, y, and z components of the vector.

Returns

NameTypeDescription
vvector The new vector.

Notes

The vector library can be called, which is shorthand for vector.pack:

vector(x, y, z) -- same as vector.pack(x, y, z)

Example

local a = vector.pack(1, 2, 3)
local b = vector.pack(5)
print(a + b) --> 6, 7, 8

-- put the 3 numbers from lovr.headset.getPosition into a vector!
local position = vector(lovr.headset.getPosition())

See also