Effecting a entire table of objects

Im using storyboard and i have inserted a table of objects in the scene. Is there a way i can effect my whole table of objects without typing out each and every object in the table?

This is the function where im adding all my objects from the table stones.

function gameLoop( event ) if (hasCollided (wall1, rock)) and leftclicked == true then map.x = map.x - 3; wall1.x = wall1.x - 3; stones[1].x = stones[1].x - 3; stones[2].x = stones[2].x - 3; end end Runtime:addEventListener( "enterFrame", gameLoop )  

Here i add my table stones to the scene group.

-- Called when the scene's view does not exist: function scene:createScene( event ) local screenGroup = self.view --Displays Map map = display.newImage( "images/baseMap1.png" ) map.x = centerXcord map.y = centerYcord screenGroup:insert( map ) --Display wall wall1 = display.newRect(-128, -96, 55, 512) wall1.alpha = 0.3 screenGroup:insert( wall1 ) rock = display.newRect(160, 160, 32, 32) screenGroup:insert( rock ) stones = { [1] = display.newRect(100, 160, 32, 32), [2] = display.newRect(100, 200, 32, 32) } screenGroup:insert( stones[1] ) screenGroup:insert( stones[2] ) end

I have tried doing something like this but i end up only effecting the first object in the table not all the objects like i want.

function gameLoop( event ) if (hasCollided (wall1, rock)) and leftclicked == true then map.x = map.x - 3; wall1.x = wall1.x - 3; for i = 1,#stones do stones[i].x = stones[i].x - 3; end end end Runtime:addEventListener( "enterFrame", gameLoop )

Any help would be appreciated thanks.