Created
November 1, 2018 11:08
-
-
Save SpaceBeeGaming/337af5ecbeb16325c4aa9347812acfa8 to your computer and use it in GitHub Desktop.
Table saver/loader for OpenComputers Minecraft mod.
This file contains hidden or 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
| local serialization = require("serialization") | |
| local tableToFile = {} | |
| function tableToFile.load(location) | |
| --returns a table stored in a file. | |
| local tableFile = assert(io.open(location)) | |
| return serialization.unserialize(tableFile:read("*all")) | |
| end | |
| function tableToFile.save(table, location) | |
| --saves a table to a file | |
| local tableFile = assert(io.open(location, "w")) | |
| tableFile:write(serialization.serialize(table)) | |
| tableFile:close() | |
| end | |
| return tableToFile |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment