print(math.floor(12.5928))
Код выше печатает 12. Что вы делаете, чтобы он печатал 12,5?
print (string.format ("%. 2f", 129.65686))
Чтобы обобщить предыдущий ответ, эта функция округляет число до любого десятичного числа:
function round(number, decimals) local power = 10^decimals return math.floor(number * power) / power end
Тогда round(12.5928, 1) дает 12.5.
round(12.5928, 1)
12.5
за двузначный раунд print (math.floor ((12.5928) * 100) / 100)
print(math.floor(12.5928 * 10) / 10)