Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local todo = {}
- local saveFile = "todo.txt"
- function save()
- local file = fs.open(saveFile,"w")
- file.write(textutils.serialize(todo))
- file.close()
- end
- function load()
- local file = fs.open(saveFile,"r")
- local data = file.readAll()
- file.close()
- todo = textutils.unserialize(data)
- end
- function list()
- for k,v in pairs(todo) do
- print(tostring(k) .. ": " .. tostring(v))
- end
- end
- load()
- list()
- table.insert(todo,2, "New 2")
Advertisement
Add Comment
Please, Sign In to add comment