I have ran into an issue where string.format does not print a leading zero when using the float specifier. Here’s the code:
message ..= string.format("Length: %3d:%02d:%03.1f\n", thour, tmin, tsec)
The problem is %03.1f
. There is no leading zero so if the value is less than 10, it displays a single digit before the decimal place. A Google search doesn’t reveal anything, and the document on string.format()
specifically says that 0
prints a leading zero. It does not have any other qualifiers.
Does anyone have any suggestions?
Thanks.