Module m.savefile
Wrapper module for io.open and io.write Files will be saved in a path created from a call to sys.get_save_file() with application id equal to the game.project config project.title with spaces replaced with underscores.
Usage:
local savefile = require "ludobits.m.savefile" local file = savefile.open("foobar") local data = file.load() file.save("something large to save")
Functions
open (filename) | Open a file for reading and writing using the io.* functions |
instance.load () | Load the table stored in the file |
instance.save (s) | Save string to the file |
Functions
- open (filename)
-
Open a file for reading and writing using the io.* functions
Parameters:
- filename
Returns:
-
file instance
- instance.load ()
-
Load the table stored in the file
Returns:
- contents File contents or nil if something went wrong
- error_message Error message if something went wrong while reading
- instance.save (s)
-
Save string to the file
Parameters:
- s The string to save
Returns:
- success
- error_message