문제

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