Code: Select all
if glob.dynamite~=nil then
for i,_ in pairs(glob.dynamite) do
glob.dynamite[i][100]=glob.dynamite[i][100]+1 --the error is here--
if glob.dynamite[i][100]==600 then
for pos=0,10,2.5 do
local entities=game.findentities({{glob.dynamite[i].position.x-pos,glob.dynamite[i].position.y-pos},{glob.dynamite[i].position.x+pos,glob.dynamite[i].position.y+pos}})
for i,_ in pairs(entities) do
if entities[i].health~=nil then
if entities[i].health<=50 then
entities[i].die()
else
entities[i].health=entities[i].health-50
end
end
end
end
glob.dynamite[i].destroy()
table.remove(glob.dynamite ,i)
end
end
end
also the part where that is declared is here:
Code: Select all
if event.createdentity.name=="dynamite" then
if glob.dynamite==nil then
glob.dynamite={}
glob.dynamitecount=0
end
glob.dynamite[glob.dynamitecount]={}
glob.dynamite[glob.dynamitecount]=event.createdentity
table.insert(glob.dynamite[glob.dynamitecount], 100, 0)
glob.dynamitecount=glob.dynamitecount+1
end