Guest User

monitor

a guest
May 28th, 2017
351
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.03 KB | None | 0 0
  1. monitor = peripheral.wrap("right")
  2. monitor.clear()
  3.  
  4. local function screenRefresh()
  5. monitor.clear()
  6. monitor.setCursorPos(1,1)
  7. local x, y = term.getCursorPos()
  8. monitor.write("     THE GRAND TODO LIST!")
  9. y=y+1
  10. monitor.setCursorPos(x,y)
  11.   for i = 1,#Table do
  12.      monitor.write("Table[i]")
  13.      monitor.setCursorPos(x,y)
  14.      y=y+1
  15.   end
  16. end
  17.  
  18. local Table = {}
  19.  
  20. print(#Table)
  21.  
  22. local input = ""
  23. local numin = 0
  24. local taskin = ""
  25. while true do
  26.   print("What would you like to do?")
  27.   print("1) Add new item.")
  28.   print("2) Remove item.")
  29.   print("3) Refresh List.")
  30.   input = read()
  31.   if (input == "1") and (#Table < 15) then
  32.     print("New Item:")
  33.     taskin = read()
  34.     table.insert(Table, taskin)
  35.     print(#Table)
  36.    -- screenRefresh()
  37.   elseif #Table > 15 then
  38.     print("Sorry, the list is full!")
  39.   end
  40.   if (input == "2") then
  41.     print("Which item should I remove?")
  42.     numin = tonumber(read())
  43.     table.remove(Table, numin)
  44.     screenRefresh()
  45.   end
  46.   if (input == "3") then
  47.     screenRefresh()
  48.   end
  49. end
Advertisement
Add Comment
Please, Sign In to add comment