Advertisement
Guest User

Untitled

a guest
Sep 18th, 2019
138
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.60 KB | None | 0 0
  1. local reactor = peripheral.wrap("BigReactors-Reactor_1")
  2. local mon = peripheral.wrap("monitor_0")
  3.  
  4. -- clear the monitor at startup
  5. mon.clear()
  6.  
  7. function repeats(s, n)
  8.   return n > 0 and s .. repeats(s, n-1) or ""
  9. end
  10.  
  11.  
  12. function drawLine (m, row, color)
  13.   local currentColor = m.getTextColor()
  14.   local oldX, oldY = m.getCursorPos()
  15.   local sizeX, sizeY = m.getSize()
  16.  
  17.   m.setCursorPos(row, 0)
  18.   m.setTextColor(color)
  19.   m.write(repeats(" ", sizeX))
  20.  
  21.   m.setCursorPos(oldX, oldY)
  22.   m.setTextColor(currentColor)
  23. end
  24.  
  25. function drawDisplay ()
  26.   drawLine(mon, 1, colors.red)
  27. end
  28.  
  29. drawDisplay()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement