質問

I would like to display a score with 7 digits. I tried to use string.format() in vain.

I have a score module and want to display like this : 0000000

My module add 10 points each time, so it has to be : 0000010 - 0000020 etc...

Any suggestion ?

役に立ちましたか?

解決

Try this:

print(string.format("%07d", 10))

Output: 0000010

07 in the format specifier means use at least 7 digits, and fills them with leading 0s.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top