Advertisement
CitraDeus

TodoList (No Monitor)

Jul 1st, 2013
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.34 KB | None | 0 0
  1. while true do
  2. local file = assert(fs.open("Todo.txt", "r"), "Failed to open Todo.txt")
  3. local textToRead = file.readAll()
  4. file.close()
  5.  
  6. local tData = textutils.unserialize(textToRead)
  7. todo1 = tData.todo1
  8. todo2 = tData.todo2
  9. todo3 = tData.todo3
  10. todo4 = tData.todo4
  11. todo5 = tData.todo5
  12. todo6 = tData.todo6
  13. todo7 = tData.todo7
  14. todo8 = tData.todo8
  15. todo9 = tData.todo9
  16.  
  17.     local sEvent, param = os.pullEvent("key")
  18.     if sEvent == "key" then
  19.       if param == 2 then
  20.         sleep(0.000001)
  21.         todo1 = read()
  22.       end
  23.       if param == 3 then
  24.         sleep(0.000001)
  25.         todo2 = read()
  26.       end
  27.       if param == 4 then
  28.         sleep(0.000001)
  29.         todo3 = read()
  30.       end
  31.       if param == 5 then
  32.         sleep(0.000001)
  33.         todo4 = read()
  34.       end
  35.       if param == 6 then
  36.       sleep(0.000001)
  37.         todo5 = read()
  38.       end
  39.       if param == 7 then
  40.         sleep(0.000001)
  41.         todo6 = read()
  42.       end
  43.       if param == 8 then
  44.         sleep(0.000001)
  45.         todo7 = read()
  46.       end
  47.       if param == 9 then
  48.         sleep(0.000001)
  49.         todo8 = read()
  50.       end
  51.       if param == 10 then
  52.         sleep(0.000001)
  53.         todo9 = read()
  54.       end
  55.       if param == 208 then
  56.           todo9 = todo8
  57.           todo8 = todo7
  58.           todo7 = todo6
  59.           todo6 = todo5
  60.           todo5 = todo4
  61.           todo4 = todo3
  62.           todo3 = todo2
  63.           todo2 = todo1
  64.           todo1 = " "
  65.       end
  66.       if param == 200 then
  67.         todo1 = todo2
  68.         todo2 = todo3
  69.         todo3 = todo4
  70.         todo4 = todo5
  71.         todo5 = todo6
  72.         todo6 = todo7
  73.         todo7 = todo8
  74.         todo8 = todo9
  75.         todo9 = " "
  76.       end
  77.     term.clear()
  78.     term.setCursorPos(1,1)
  79.     print("Ezra")
  80.  
  81.     print(" ")
  82.     print("1. ".. todo1)
  83.  
  84.     print("2. ".. todo2)
  85.  
  86.     print("3. ".. todo3)
  87.  
  88.     print("4. ".. todo4)
  89.  
  90.     print("5. ".. todo5)
  91.  
  92.     print("6. ".. todo6)
  93.  
  94.     print("7. ".. todo7)
  95.  
  96.     print("8. ".. todo8)
  97.  
  98.     print("9. ".. todo9)
  99.   end
  100.  
  101. local tableToSave = {todo1=todo1, todo2=todo2, todo3=todo3, todo4=todo4, todo5=todo5, todo6=todo6, todo7=todo7, todo8=todo8, todo9=todo9}
  102. local stringToSave = textutils.serialize(tableToSave)
  103.  
  104. local file = assert(fs.open("Todo.txt", "w"), "Failed to open Todo.txt")
  105. file.write(stringToSave)
  106. file.close()
  107. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement