Skip to content

Brainy0789/ChromaSave

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ChromaSave

ChromaSave is a simple way to store save data using .JSON!

Installation

haxelib install chromasave

Usage

import save.ChromaSave;
import save.util.ChromaConvert;

class Main
{
    static function main()
    {
        // Create a new ChromaSave instance for the 'save' file
        var chromaSave = new ChromaSave("save");

        // Parse existing JSON from disk (if it exists)
        chromaSave.parse();

        // Add or update a field in the save data
        chromaSave.set("field", true);

        // Access the value
        Sys.println(chromaSave.get("field")); // outputs 'true'

        // Write the current data to disk
        chromaSave.save();

        // --- Migrating from FlxSave ---
        // Convert FlxG.save to a ChromaSave instance
        chromaSave = ChromaConvert.fromFlxG("save");

        //You can also use any FlxSave instance with this
        chromaSave = ChromaConvert.convertFlxSave(FlxG.save);
    }
}

About

Haxelib for JSON based Save Data! Requires Lime.

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages