This is giving me an Error in 82
main.lua:82: ERROR: table expected. If this is a function call, you might have used ‘.’ instead of ‘:’
Stack traceback:
[C]: in function ‘addBody’
main.lua:82: in function ‘loadAsteroid’
main.lua:165: in function ‘_listener’
?: in function <?:167>
?:in function <?:221>
Any Ideas?
local function loadAsteroid() numAsteroids= numAsteroids +1 asteroidsTable[numAsteroids] = display.newImage("asteroids1-1a.png") (82) physics.addBody(asteroidsTable[numAsteroids], {density=1,friction=0.4,bounce=1}) local whereFrom = math.random(3) asteroidsTable[numAsteroids].myName="asteroid" --Spawns if(whereFrom==1) then asteroidsTable[numAsteroids].x = -50 asteroidsTable[numAsteroids].y = (math.random( display.contentHeight \*.75)) transition.to(asteroidsTable[numAsteroids], {x= (display.contentWidth +100), y=(math.random( display.contentHeight)), time =(math.random( 5000, 10000))}) elseif(whereFrom==2) then asteroidsTable[numAsteroids].x = (math.random( display.contentWidth)) asteroidsTable[numAsteroids].y = -30 transition.to(asteroidsTable[numAsteroids], {x= (math.random(display.contentWidth)), y=(display.contentHeight + 100), time =(math.random(5000, 10000))}) elseif(whereFrom==3) then asteroidsTable[numAsteroids].x = display.contentWidth+50 asteroidsTable[numAsteroids].y = (math.random( display.contentHeight \*.75)) transition.to(asteroidsTable[numAsteroids], {x= -100, y=(math.random(display.contentHeight)), time =(math.random(5000, 10000))}) end end local function gameLoop() updateText() (165) loadAsteroid() --remove old shots fired so they don't stack for i = 1, table.getn(shotTable) do if (shotTable[i].myName ~= nil and shotTable[i].age \< maxShotAge) then shotTable[i].age = shotTable[i].age + tick elseif (shotTable[i].myName ~= nil) then shotTable[i]:removeSelf() shotTable[i].myName=nil end end end