jgoemat Master Cheater Reputation: 22
Joined: 25 Sep 2011 Posts: 252
|
Posted: Sat Jul 21, 2018 3:17 am Post subject: Loading/Saving Text files or lua |
|
|
I wrote a couple functions to help loading and saving text files. They default to on disk, but you can pass a flag to load/save to a TableFile. When loading a file that doesn't exist on disk it will fall back to a TableFile.
I found a pretty good serialization library and wanted something like this to store settings, like what cheats you want enabled by default. Actually for some mono work I'm doing so you can specify classes you want to ignore.
Code: | -- save config object to table file 'config.lua'
saveTextFile('config.lua', serialize.toString(config), true)
-- load config from disk file, fall back to table file
config = loadstring(loadTextFile('config.lua'))() |
Description: |
|
Download |
Filename: |
TextFiles.lua |
Filesize: |
3.61 KB |
Downloaded: |
831 Time(s) |
|
|