So I just started Object Oriented Programming but I run to this annoying problem. I keep getting warnings saying that setmetatable should take a table and that animationTracks cannot be added to a table.
--!strict
local Creature = require(script.Parent)
local Enemy = {}
Enemy.__index = Enemy
setmetatable(Enemy, Creature)
function Enemy.new(model: Model)
local newEnemy = Creature.new(model)
setmetatable(newEnemy, Enemy)
newEnemy.animationTracks = {}
return newEnemy
end
return Enemy
I get the following warnings
setmetatable should take a table
cannot add property "animationTrack" to table
How can I get rid of them? Any workaround or other solution that would work?