Skip to content

Two very simple load and save function to store a Lua Table and Read it back in. Requires the Corona SDK JSON Library

Notifications You must be signed in to change notification settings

robmiracle/Simple-Table-Load-Save-Functions-for-Corona-SDK

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 

Repository files navigation

Simple to use Table Save and Table Load functions for Lua and Corona SDK

USAGE:

local loadsave = require("loadsave")

myTable = {}
myTable.musicOn = false
myTable.soundOn = true

loadsave.saveTable(myTable, "myTable.json")

Then to read it back in: myTable = loadsave.loadTable("myTable.json")

This basic code, by default, uses system.DocumentsDirectory to save game settings. If you need to save files to other locations, you can pass another argument "CachesDirectory" or "TemporaryDirectory" to the function to apply the change to the specified location.

For example: loadsave.saveTable(myTable, "myTable.json", system.TemporaryDirectory) loadsave.loadTable("myTable.json", system.TemporaryDirectory)

If you'd like to change the default directory, then you can change the variable in the code (DefaultLocation = system.TemporaryDirectory) or call loadsave.changeDefault(system.TemporaryDirectory) within your code.

About

Two very simple load and save function to store a Lua Table and Read it back in. Requires the Corona SDK JSON Library

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages