FFGFlash

api/data

Sep 17th, 2021 (edited)
111
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.31 KB | None | 0 0
  1. function load(path)
  2.     if not fs.exists(path) then return {}, false end
  3.     local f = fs.open(path, "r")
  4.     local t = textutils.unserialize(f.readAll())
  5.     f.close()
  6.     return t or {}, true
  7. end
  8.  
  9. function save(path, data)
  10.   local f = fs.open(path, "w")
  11.   f.write(textutils.serialize(data))
  12.   f.close()
  13. end
Add Comment
Please, Sign In to add comment