mirror of
https://github.com/1bardesign/batteries.git
synced 2024-11-29 08:14:35 +00:00
slightly tweaked vec2 new
This commit is contained in:
parent
a61a8a8618
commit
4bb3da7603
6
vec2.lua
6
vec2.lua
@ -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
|
||||||
|
Loading…
Reference in New Issue
Block a user