Advertisement
incinirate

File API

Aug 4th, 2014
294
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.32 KB | None | 0 0
  1. function saveToFile(file,tbl)
  2. local hand = fs.open(file,"w")
  3. for i=1,#tbl do
  4. hand.write(tbl[i])
  5. end
  6. hand.close()
  7. end
  8.  
  9. function loadFromFile(file)
  10. local hand = fs.open(file,"r")
  11. local n = {}
  12. repeat
  13. local ln = hand.readLine()
  14. if ln then table.insert(n,ln) end
  15. until not ln
  16. return n
  17. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement