slightly tweaked vec2 new

This commit is contained in:
Max Cahill 2021-07-23 14:38:14 +10:00
parent a61a8a8618
commit 4bb3da7603

View File

@ -18,8 +18,6 @@ end
--ctor --ctor
function vec2:new(x, y) function vec2:new(x, y)
--0 init by default
self:scalar_set(0)
if type(x) == "number" then if type(x) == "number" then
self:scalar_set(x, y) self:scalar_set(x, y)
elseif type(x) == "table" then elseif type(x) == "table" then
@ -30,10 +28,12 @@ function vec2:new(x, y)
else else
self:scalar_set(x.x, x.y) self:scalar_set(x.x, x.y)
end end
else
self:scalar_set(0)
end end
end end
--explicit ctors --explicit ctors; mostly vestigial at this point
function vec2:copy() function vec2:copy()
return vec2(self.x, self.y) return vec2(self.x, self.y)
end end