Simple LUA question

I’m piggy backing off of the FrameAnimation2 tutorial code

function collection:enterFrame( event )  
 for \_,ball in ipairs( collection ) do  
 local dx = ( ball.xspeed \* ball.xdir );  
 local dy = ( ball.yspeed \* ball.ydir );  
 local xNew, yNew = ball.x + dx, ball.y + dy  
  
 local radius = ball.radius  
 if ( xNew \> screenRight - radius or xNew \< screenLeft + radius ) then  
 ball.xdir = -ball.xdir  
 end  
 if ( yNew \> screenBottom - radius or yNew \< screenTop + radius ) then  
 ball.ydir = -ball.ydir  
 end  
  
 for \_,tempball in ipairs( collection ) do  
 local ballx = ball.xNew  
 local ballt = tempball.x  
 textObject2.text = (ballx)  
 textObject3.text = (ballt)   
 end  
  
 ball:translate( dx, dy )  
 end  
end  

for some reason i’m not getting anything displayed for

 textObject3.text = (ballt)   

what am i messing up here? [import]uid: 131583 topic_id: 23228 reply_id: 323228[/import]

Try using print (ballt) before you try to set your text with it; does it print something valid, or nil? [import]uid: 52491 topic_id: 23228 reply_id: 92949[/import]

Is this code being ran at all?

Note that “enterFrame” event is only available for “Runtime” object. You can’t add an event listener for enterFrame on an arbitrary object of yours. [import]uid: 61899 topic_id: 23228 reply_id: 93050[/import]

Also, put a tostring() around ballt when you print it, this way you will see “nil” being displayed when it’s nil (instead of just seeing blank, which happens without tostring() ). [import]uid: 10284 topic_id: 23228 reply_id: 93057[/import]