Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我需要显示从 00:10 到 00:09 而不是 00:9 的倒计时。如何确保给定的数字显示为两位数,而不使用繁琐的 if 语句?
这完全可以在没有if语句的情况下完成,它只是字符串格式......
if
local secondTime = 0 local minuteTime = 10 print(string.format("%02d:%02d",minuteTime,secondTime))