Hello everyone! I am making a game and I have a function that turn seconds to minutes, but I only have 300 seconds or 5 minutes running and the function I have formats the minutes to 05:00 not 5:00.
Here is the function
local function toMS(s)
return ("%02i:%02i"):format(s/60%60,s%60)
end
If you know how to make it say 5:00 and not 05:00 please let me know!
If that doesn’t work try the entire format %d:%02d, that is the pattern I always use. Not sure what the difference between %d and %i is, but the former always works on my machine.
“Decimal” as in a base-10 integer, not “decimal” as in a number with a decimal. In C++ something like “012” will act different when formatted with %i or %d, but Lua treats both as decimal.