Help with formatting big numbers! Fast please!

I need help with big numbers in corona sdk. I am making big project which has very large numbers, like 1K, 10K, 100K, 1M, 10M, 100M … and so on…

So my problem is that, when the numbers get bigger they start to go out of the screen. So how can I do this; when the numbers get bigger the scoreText becomes smaller. And when the scoreText becomes smaller it becomes larger. Guys. Please show an example. Do not link any useless links to other web pages. C’mon. Help fast please!.

I am in such a hurry, please hurry up!

Not the greatest way to ask for help, but I’m feeling generous.

Decide a maximum width you want your scoreText to be, and edit the value below.

[lua]

local maxWidth = 100

scoreText.xScale = 1

if scoreText.width > maxWidth then

      scoreText.xScale = scoreText.xScale / scoreText.width * maxWidth

end

[/lua]

Thank you so much @nick_sherman ! That was the thing I needed!

Ps changed my name from Mr. Coder to Coder101

@Mr. Coder

Forum rules only permit bumping your post once per day.

Secondly, please understand that everyone in the community is here on their own schedule. Asking for “Urgent” help isn’t going to get you answered any faster.

Rob

First you can do that

if value\>1000000000 then value=mathfloor(value\*0.000000001).."G" elseif value\>1000000 then value=mathfloor(value\*0.000001).."M" elseif value\>1000 then value=mathfloor(value\*0.001).."k" end

Secondly you can use nick_sherman solution

Rémi

I am in such a hurry, please hurry up!

Not the greatest way to ask for help, but I’m feeling generous.

Decide a maximum width you want your scoreText to be, and edit the value below.

[lua]

local maxWidth = 100

scoreText.xScale = 1

if scoreText.width > maxWidth then

      scoreText.xScale = scoreText.xScale / scoreText.width * maxWidth

end

[/lua]

Thank you so much @nick_sherman ! That was the thing I needed!

Ps changed my name from Mr. Coder to Coder101

@Mr. Coder

Forum rules only permit bumping your post once per day.

Secondly, please understand that everyone in the community is here on their own schedule. Asking for “Urgent” help isn’t going to get you answered any faster.

Rob

First you can do that

if value\>1000000000 then value=mathfloor(value\*0.000000001).."G" elseif value\>1000000 then value=mathfloor(value\*0.000001).."M" elseif value\>1000 then value=mathfloor(value\*0.001).."k" end

Secondly you can use nick_sherman solution

Rémi