Advertisement
SuperMcBrent

dataLib

Jan 22nd, 2022
754
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function serialize(data, name)
  2.     if not fs.exists('/data') then
  3.         fs.makeDir('/data')
  4.     end
  5.     local f = fs.open('/data/'..name, 'w')
  6.     f.write(textutils.serialize(data))
  7.     f.close()
  8. end
  9.  
  10. function unserialize(name)
  11.     if fs.exists('/data/'..name) then
  12.         local f = fs.open('/data/'..name, 'r')
  13.         data = textutils.unserialize(f.readAll())
  14.         f.close()
  15.     end
  16.     return data
  17. end
Advertisement
Advertisement
Advertisement
RAW Paste Data Copied
Advertisement