How to format text and numbers nicely?
String concatenation works on both strings and numbers, but does not give you any control over the formatting of the numbers, which is particularly important when dealing with floating-point values. The function string.format works like C’s sprintf: you give it a string containing a format string, and a number of values. Numerical formats like ‘%5.2f’ are understood (field width of 5, two places after the decimal point) or ‘%02d’ (field width of 2, pad out with zeroes – ’01’, etc). ‘%s’ means as a string, ‘%q’ means as a quoted string, that is, a format that Lua can read back.