class

GSDL::GameData

Inherits Reference < Object

NOTE: can be accessed from GSDL::Data singleton defined at the bottom of this file

Constructors

Instance methods

[](*keys : String)

Shorthand for dig

Source
clear

Clear all data

Source
data

Access the raw data hash

Source
dig(*keys : String) : JSON::Any

Deep get using multiple keys Example: Data.dig("quests", "apples", "collected")

Source
get(key : String) : JSON::Any

Get a value, returns JSON::Any

Source
increment(key : String, amount = 1)

Shorthand for incrementing a number

Source
load(path : String)

Load state from a file, auto-detecting binary or JSON format

Source
save(path : String)

Default save uses binary format

Source
save_binary(path : String)

Save the entire state to a binary file

Source
save_json(path : String)

Save the entire state to a JSON file

Source
set(key : String, value)

Set a value at a specific key path Example: Data.set("player", "score", 100)

Source
set(keys : Array(String), value)

Set nested values using multiple keys Example: Data.set(["quests", "apples", "collected"], 5)

Source
true?(*keys : String) : Bool

Convenience for boolean checks Example: if Data.true?("level1", "solved")

Source