Advertisement
Inkkubus

speicher von variablen in einer datei

Jul 17th, 2015
231
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.42 KB | None | 0 0
  1. function save(...)
  2. local filehandle = fs.open("appdata","w")
  3. filehandle.write(textutils.serialize({...}))
  4. filehandle.close()
  5. end
  6.  
  7. function load()
  8. local filehandle = fs.open("appdata", "r")
  9. local data = filehandle.readAll();
  10. filehandle.close()
  11. return unpack(textutils.unserialize(data))
  12. end
  13.  
  14.  
  15. save(id, otherdata, whatever)
  16.  
  17. id, otherdata, whatever = load()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement