Add vector.zeros

This commit is contained in:
Lars Mueller 2022-01-12 12:16:02 +01:00
parent 9bbbcae162
commit 71b6d9769d

@ -36,6 +36,13 @@ function new(v)
return setmetatable(v, metatable) return setmetatable(v, metatable)
end end
function zeros(n)
local v = {}
for i = 1, n do
v[i] = 0
end
return new(v)
end
function from_xyzw(v) function from_xyzw(v)
return new{v.x, v.y, v.z, v.w} return new{v.x, v.y, v.z, v.w}
end end