Advertisement
Guest User

Untitled

a guest
Oct 22nd, 2016
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.03 KB | None | 0 0
  1.  
  2.   famount = math.abs(round(amount,decimal))
  3.   famount = math.floor(famount)
  4.  
  5.   remain = round(math.abs(amount) - famount, decimal)
  6.  
  7.         -- comma to separate the thousands
  8.   formatted = comma_value(famount)
  9.  
  10.         -- attach the decimal portion
  11.   if (decimal > 0) then
  12.     remain = string.sub(tostring(remain),3)
  13.     formatted = formatted .. "." .. remain ..
  14.                 string.rep("0", decimal - string.len(remain))
  15.   end
  16.  
  17.         -- attach prefix string e.g '$'
  18.   formatted = (prefix or "") .. formatted
  19.  
  20.         -- if value is negative then format accordingly
  21.   if (amount<0) then
  22.     if (neg_prefix=="()") then
  23.       formatted = "("..formatted ..")"
  24.     else
  25.       formatted = neg_prefix .. formatted
  26.     end
  27.   end
  28.  
  29.   return formatted
  30. end
  31.  
  32. -- Clear and make the pixel smaller because we are not blind
  33.  
  34. mon.setBackgroundColor(colors.black)
  35. mon.clear()
  36. mon.setTextScale(0.5)
  37.  
  38. -- Get the information from the index file
  39. getInfoFromFile()
  40.  
  41.  
  42. -- Add's the visual and starts the Loop
  43. addDrawBoxesSingleReactor()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement