I need to display a countdown that turns from 00:10 to 00:09 and not 00:9. How do I make sure that a given number displays with two digits without resorting to cumbersome if-statements?
This is completely possible to do without an if
statement, it's just string formatting...
local secondTime = 0
local minuteTime = 10
print(string.format("%02d:%02d",minuteTime,secondTime))
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With