Advertisement
mrkarp

ToDO

Jul 10th, 2016
132
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.84 KB | None | 0 0
  1. -- ToDoList
  2. -- MrKarp 4/1/2016 "April Fools"
  3. -- Pop on and off items in a table to represent a editable todo list
  4.  
  5. monitor = peripheral.wrap("back")
  6. Table = {}
  7. itemNum = 0
  8.  
  9. function ClearMon()
  10.     monitor.clear()
  11. end
  12.  
  13. function GetInput()
  14.     write("Enter Item: ")
  15.     input = read()
  16.     table.insert(Table, input)
  17.     itemNum = itemNum + 1
  18.     --monitor.write(itemNUm..": "..input)
  19. end
  20.  
  21. function ClearItem()
  22.     monitor.write("Delete Which Item #?: ")
  23.     delInput = read()
  24.     table.delete(Table, delInput)
  25. end
  26.  
  27. function Display()
  28. monitor.setCursorPos(1,1)
  29.     for i=0, #Table do
  30.         monitor.write(Table[i])
  31.         monitor.setCursorPos(1,i)
  32.     end
  33. end
  34.  
  35. function Choice()
  36.     write("1.Add 2.Delete: ")
  37.     choice = read()
  38.     if(choice=="1") then
  39.     GetInput()
  40.     end
  41.     if(choice=="2") then
  42.     ClearItem()
  43.     end
  44.     ClearMon()
  45.     Display()
  46. end
  47.  
  48. while true do
  49.     Choice()
  50. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement