local vector2D = {x, y}
vector2D.__index = vector2D
--Metafunctions
local vectorMeta = {
__call = function(a, b)
love.graphics.print("love")
end,
__add = function(a, b)
return vector2D(a.x + b.x, a.y + b.y)
end,
__sub = function(a, b)
return vector2D(a.b - b.x. a.y - b.y)
end
}
setmetatable(vector2D, vectorMeta)
--Constructor
function vector2D.new(x, y)
local self = {x = x or 0, y = y or 0}
setmetatable(self, vector2D)
return self
end
--Class functions
function vector2D:normalize(vector2D)
--do stuff
end
Lovingsoul1337 wrote: ↑Fri Apr 10, 2020 9:51 am
I dont know but change it gives the same error...
You're setting the __call metamethod to a dummy function that just calls love.graphics.print("love"), and then using it as a constructor in the __add metamethod. Try setting it like this: