How to Display Numeric Values on the Screen?

Silly question, but suppose I have a variable called “number” with a value 5, how do I display the number 5 on the screen?

Are you wanting just a plain text field or do you have .png images that you want to use for the numbers?

-Saer

Just a plain text field but the value is not permanent, meaning that if “number” changes to 7 or 9, the display will follow too.

I think I’ve got it. I should really have researched first. My brain is just fried right now.

local number=5 displayNumber=display.newText(string.format("%d ", number), 100, 100, native.systemFontBold, 30)  

…did the trick.

lol the docs are great. :wink:

Do you have it updating correctly?

-Saer

Yes, it is, and I do. Thanks for helping :slight_smile:

Are you wanting just a plain text field or do you have .png images that you want to use for the numbers?

-Saer

Just a plain text field but the value is not permanent, meaning that if “number” changes to 7 or 9, the display will follow too.

I think I’ve got it. I should really have researched first. My brain is just fried right now.

local number=5 displayNumber=display.newText(string.format("%d ", number), 100, 100, native.systemFontBold, 30)  

…did the trick.

lol the docs are great. :wink:

Do you have it updating correctly?

-Saer

Yes, it is, and I do. Thanks for helping :slight_smile: