mirror of
https://github.com/1bardesign/batteries.git
synced 2024-11-10 02:31:48 +00:00
fixed vec2/vec3 crashing on attempted copy construction from something that had a type field which wasn't a callable type() method (eg objects from tiled)
This commit is contained in:
parent
6ef19cfde0
commit
a339854651
2
vec2.lua
2
vec2.lua
@ -21,7 +21,7 @@ function vec2:new(x, y)
|
|||||||
if type(x) == "number" or type(x) == "nil" then
|
if type(x) == "number" or type(x) == "nil" then
|
||||||
self:sset(x or 0, y)
|
self:sset(x or 0, y)
|
||||||
elseif type(x) == "table" then
|
elseif type(x) == "table" then
|
||||||
if x.type and x:type() == "vec2" then
|
if type(x.type) == "function" and x:type() == "vec2" then
|
||||||
self:vset(x)
|
self:vset(x)
|
||||||
elseif x[1] then
|
elseif x[1] then
|
||||||
self:sset(x[1], x[2])
|
self:sset(x[1], x[2])
|
||||||
|
2
vec3.lua
2
vec3.lua
@ -23,7 +23,7 @@ function vec3:new(x, y, z)
|
|||||||
if type(x) == "number" or type(x) == "nil" then
|
if type(x) == "number" or type(x) == "nil" then
|
||||||
self:sset(x or 0, y, z)
|
self:sset(x or 0, y, z)
|
||||||
elseif type(x) == "table" then
|
elseif type(x) == "table" then
|
||||||
if x.type and x:type() == "vec3" then
|
if type(x.type) == "function" and x:type() == "vec3" then
|
||||||
self:vset(x)
|
self:vset(x)
|
||||||
elseif x[1] then
|
elseif x[1] then
|
||||||
self:sset(x[1], x[2], x[3])
|
self:sset(x[1], x[2], x[3])
|
||||||
|
Loading…
Reference in New Issue
Block a user