i keep receiving an error when i try to run my lua script. The error is: bad argument #1 to 'insert' (table expected, got nil)
here is my gameloop code:
local GameLoop = {}
local insert = table.insert
local remove = table.remove
function GameLoop:create()
local gameLoop = {}
function gameLoop:addLoop(obj)
insert(self.clocks,obj)
end
function gameLoop:update(dt)
for clocks = 0,#self.clocks do
local obj = self.clocks[clocks]
if obj ~= nil then
obj:tick(dt)
end
end
end
return gameLoop
end
return GameLoop