Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- while true do
- local file = assert(fs.open("Todo.txt", "r"), "Failed to open Todo.txt")
- local textToRead = file.readAll()
- file.close()
- local tData = textutils.unserialize(textToRead)
- todo1 = tData.todo1
- todo2 = tData.todo2
- todo3 = tData.todo3
- todo4 = tData.todo4
- todo5 = tData.todo5
- todo6 = tData.todo6
- todo7 = tData.todo7
- todo8 = tData.todo8
- todo9 = tData.todo9
- local sEvent, param = os.pullEvent("key")
- if sEvent == "key" then
- if param == 2 then
- sleep(0.000001)
- todo1 = read()
- end
- if param == 3 then
- sleep(0.000001)
- todo2 = read()
- end
- if param == 4 then
- sleep(0.000001)
- todo3 = read()
- end
- if param == 5 then
- sleep(0.000001)
- todo4 = read()
- end
- if param == 6 then
- sleep(0.000001)
- todo5 = read()
- end
- if param == 7 then
- sleep(0.000001)
- todo6 = read()
- end
- if param == 8 then
- sleep(0.000001)
- todo7 = read()
- end
- if param == 9 then
- sleep(0.000001)
- todo8 = read()
- end
- if param == 10 then
- sleep(0.000001)
- todo9 = read()
- end
- if param == 208 then
- todo9 = todo8
- todo8 = todo7
- todo7 = todo6
- todo6 = todo5
- todo5 = todo4
- todo4 = todo3
- todo3 = todo2
- todo2 = todo1
- todo1 = " "
- end
- if param == 200 then
- todo1 = todo2
- todo2 = todo3
- todo3 = todo4
- todo4 = todo5
- todo5 = todo6
- todo6 = todo7
- todo7 = todo8
- todo8 = todo9
- todo9 = " "
- end
- term.clear()
- term.setCursorPos(1,1)
- print("Ezra")
- print(" ")
- print("1. ".. todo1)
- print("2. ".. todo2)
- print("3. ".. todo3)
- print("4. ".. todo4)
- print("5. ".. todo5)
- print("6. ".. todo6)
- print("7. ".. todo7)
- print("8. ".. todo8)
- print("9. ".. todo9)
- end
- local tableToSave = {todo1=todo1, todo2=todo2, todo3=todo3, todo4=todo4, todo5=todo5, todo6=todo6, todo7=todo7, todo8=todo8, todo9=todo9}
- local stringToSave = textutils.serialize(tableToSave)
- local file = assert(fs.open("Todo.txt", "w"), "Failed to open Todo.txt")
- file.write(stringToSave)
- file.close()
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement