vlatkovski

Round decimals

Mar 10th, 2015
355
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.13 KB | None | 0 0
  1. local function round(n, d) -- number, number of decimals
  2.     n = tostring(n);
  3.     return tonumber(n:sub(1, n:find("%.") + d or 2));
  4. end
Advertisement
Add Comment
Please, Sign In to add comment