Guest User

Untitled

a guest
Oct 15th, 2018
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.39 KB | None | 0 0
  1. monitor = peripheral.wrap("right")
  2.  
  3. function drawTime()
  4.   time = os.time()
  5.   timeText = textutils.formatTime(time, true)
  6.  
  7.   -- horizontally center
  8.   w, h = monitor.getSize()
  9.   x = 1 + (w - 5) / 2 + (5 - string.len(timeText))
  10.   y = 1 + (h - 1) / 2
  11.  
  12.   -- draw
  13.   monitor.clear()
  14.   monitor.setCursorPos(x, y)
  15.   monitor.write(timeText)
  16. end
  17.  
  18. while true do
  19.   drawTime()
  20.   os.sleep(1)
  21. end
Add Comment
Please, Sign In to add comment