Last active
October 24, 2015 16:13
-
-
Save mskorzhinskiy/19b07acbfd5dcd14e0d3 to your computer and use it in GitHub Desktop.
Table serialization to file for Alan
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function table_save(table, filename) | |
local file = fs.open("w", filename) | |
local data = textutils.serialize(table) | |
file.write(data) | |
file.close() | |
end | |
function table_load(filename) | |
local file = fs.open("r", filename) | |
local data = file.readAll() | |
local table = textutils.unserialize(data) | |
file.close() | |
return table | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment