NielsUtrecht

todo

Sep 7th, 2013
49
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.45 KB | None | 0 0
  1. local todo = {}
  2. local saveFile = "todo.txt"
  3.  
  4. function save()
  5.     local file = fs.open(saveFile,"w")
  6.     file.write(textutils.serialize(todo))
  7.     file.close()
  8. end
  9.  
  10. function load()
  11.     local file = fs.open(saveFile,"r")
  12.     local data = file.readAll()
  13.     file.close()
  14.     todo = textutils.unserialize(data)
  15. end
  16.  
  17. function list()
  18.     for k,v in pairs(todo) do
  19.         print(tostring(k) .. ": " .. tostring(v))
  20.     end
  21. end
  22.  
  23.  
  24. load()
  25. list()
  26.  
  27. table.insert(todo,2, "New 2")
Advertisement
Add Comment
Please, Sign In to add comment