mirror of
https://github.com/1bardesign/batteries.git
synced 2024-11-10 02:31:48 +00:00
[fixed] vec3:new - seldom used but still important
This commit is contained in:
parent
9d556574f1
commit
94005675e9
12
vec3.lua
12
vec3.lua
@ -25,15 +25,17 @@ vec3.type = "vec3"
|
|||||||
|
|
||||||
--probably-too-flexible ctor
|
--probably-too-flexible ctor
|
||||||
function vec3:new(x, y, z)
|
function vec3:new(x, y, z)
|
||||||
if x and y then
|
if x and y and z then
|
||||||
return vec3:xyz(x, y, z)
|
return vec3:xyz(x, y, z)
|
||||||
elseif x then
|
elseif x then
|
||||||
if type(x) == "number" then
|
if type(x) == "number" then
|
||||||
return vec3:filled(x)
|
return vec3:filled(x)
|
||||||
elseif x.type == "vec3" then
|
elseif type(x) == "table" then
|
||||||
return x:copy()
|
if x.type == "vec3" then
|
||||||
elseif type(x) == "table" and x[1] and x[2] and x[3] then
|
return x:copy()
|
||||||
return vec3:xyz(x[1], x[2], x[3])
|
elseif x[1] and x[2] and x[3] then
|
||||||
|
return vec3:xyz(x[1], x[2], x[3])
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
return vec3:zero()
|
return vec3:zero()
|
||||||
|
Loading…
Reference in New Issue
Block a user