Advertisement
Bolodefchoco_LUAXML

[Math] math.reduceDec

Sep 18th, 2016
187
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.35 KB | None | 0 0
  1. --Creator: Bolodefchoco
  2. --Made in: 18/09/2016
  3. --Last update: 18/09/2016
  4. --[[ Notes:
  5.     Does:
  6.         Reduz o número decimal
  7.     Args:
  8.         x --> O número decimal (Exemplo: 13.33333)
  9.         n --> A quantidade de números desejados (1 = 13.3, 2 = 13.33)
  10. ]]--
  11.  
  12. math.reduceDec = function(x,n)
  13.     local d = n and "1"..("0"):rep(n) or 100
  14.     return math.floor(x*d)/d
  15. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement