Getting a value from display.newText function

Hi All

Im trying to get the value from :

num1 = display.newText( 123, 60,  100, native.systemFont, 50 )

This is so I can call and use num1 as a variable be it, 123 etc.

When I goto retrieve the value I get a table value which I understand why, but would like to know how to get the 123 from num1. This is because num1 for me is an object on the screen, such as a score system.

Thanks

num1.text 

bear in mind this will be the string 123 not the number.

Yes, @paulscottrobson is correct. Of course, you can use the Lua “tonumber()” function to try and convert it to a numeric type:

http://docs.coronalabs.com/api/library/global/tonumber.html

Brent

Yes, both solutions worked in what I wanted to do, thanks!

num1.text 

bear in mind this will be the string 123 not the number.

Yes, @paulscottrobson is correct. Of course, you can use the Lua “tonumber()” function to try and convert it to a numeric type:

http://docs.coronalabs.com/api/library/global/tonumber.html

Brent

Yes, both solutions worked in what I wanted to do, thanks!