Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- apis/Database
- function saveTable(name, table)
- local file = fs.open("dbs/" .. name, "w")
- file.write(textutils.serialize(table))
- file.close()
- end
- function loadTable(name)
- local file = fs.open("dbs/" .. name, "r")
- if file == nil then
- return nil
- end
- local data = file.readAll()
- file.close()
- return textutils.unserialize(data)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement