number display error

I am trying to display the final value of the timer.count but I am getting an error something like this.Please anybody figure it out what the problem is?

Runtime error:bad argument #1 to '\_newText'<string expected got nil><br>

<br>local t = display.newText( "0", 115, 105, 160 )<br>t:setTextColor( 0, 0, 0 )<br>function t:timer( event )<br> count = event.count<br> self.text = count<br> if count &gt;= 20 then<br> timer.cancel( event.source )<br>local num=count<br> end<br>end<br><br>timer.performWithDelay( 500, t, 50 )<br><br>local ti = display.newText( num, 100, 100, 160 )<br>ti:setTextColor( 0, 0, 0 )<br><br>
[import]uid: 82446 topic_id: 17054 reply_id: 317054[/import]

there are 2 problems.

  1. num should be declared outside timer function
  2. newtext function should have 5 arguments
    (text,left,right,font,size)

see the sample
[lua]local t = display.newText(“0”, 115, 105, nil, 25 )
t:setTextColor( 255, 255, 255 )

local num = 0
function t:timer( event )
count = event.count
self.text = count
if count >= 20 then
timer.cancel( event.source )
num=count
end
end

timer.performWithDelay( 500, t, 50 )

local ti = display.newText( num, 100, 100, nil,25 )
ti:setTextColor( 255, 255, 255 )[/lua]

when i try this code the strings overlaps. I dint understand what you are trying to achieve with this. [import]uid: 71210 topic_id: 17054 reply_id: 64039[/import]