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:

  1. contents File contents or nil if something went wrong
  2. 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:

  1. success
  2. error_message
generated by LDoc 1.4.6 Last updated 2017-11-27 06:48:33