LUA : Round

-- 四舍五入 -- idp : 精度,>0表示小数点后几位,=0表示整数,<0表示十百千...位 function Round(num, idp) local mult = 10^(idp or 0) local ret = math.floor(num * mult + 0.5) / mult print(ret) return ret end

Be the first to comment

You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.