Advertisement
soulgriever

tools

Nov 27th, 2018
191
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.69 KB | None | 0 0
  1. function clear()
  2.  term.setBackgroundColor(colors.black)
  3.  term.setTextColor(colors.white)
  4.  term.setCursorPos(1,1)
  5.  term.clear()
  6. end
  7.  
  8. function line(x,y)
  9.  local cX,cY = term.getCursorPos()
  10.  term.setBackgroundColor(colors.black)
  11.  term.setTextColor(colors.white)
  12.  term.setCursorPos(cX+x,cY+y)
  13. end
  14.  
  15. function comma(amount)
  16.  local formatted = amount
  17.  while true do
  18.   formatted, k = string.gsub(formatted, "^(-?%d+)(%d%d%d)", '%1,%2')
  19.   if (k==0) then
  20.    break
  21.   end
  22.  end
  23.  return formatted
  24. end
  25.  
  26. function round(num, numDecimalPlaces)
  27.   local mult = 10^(numDecimalPlaces or 0)
  28.   return math.floor(num * mult + 0.5) / mult
  29. end
  30.  
  31. local mon = peripheral.wrap("top")
  32. monX, monY = mon.getSize()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement