(Fix #33, #35) A more flexible definition of isvector(v)

Now returns true if `v' is a table and both `v.x' and `v.y' are numbers.
This commit is contained in:
Matthias Richter 2014-08-22 13:47:55 +02:00
parent bd10ec4caf
commit e8af2a6ec2

View File

@ -36,7 +36,7 @@ end
local zero = new(0,0)
local function isvector(v)
return getmetatable(v) == vector
return type(v) == 'table' and type(v.x) == 'number' and type(v.y) == 'number'
end
function vector:clone()