Skip to main content
volvox.Config (defined in Util/Config.lua) reads and writes JSON settings files under scripts/LootRoute/, keyed by character and realm, with in-memory caching.

Storage

  • Path template: scripts/LootRoute/DemonGUISettings<CharacterName><RealmName>.json (relative to C:/WGG/; realm whitespace stripped; either piece falls back to "Unknown" during early login). The directory is created on load if missing.
  • Key format: flat dotted-namespace strings — e.g. gatherer.enabled, general.tickrate, modules.gatherer. Keys are top-level entries in the JSON object, not nested tables.
  • File I/O and JSON resolve through volvox.ResolveApiFunction, so the layer works across WGG API naming variants. Profile decoding accepts both direct table returns and WGG’s Lua-source string return form. If a profile exists only at the legacy scripts/Gatherer/ or configs/Demon/ path, it is read once and migrated to scripts/LootRoute/.

Read fallback chain

Config:Read resolves a value in this order:
  1. Stored value in the cached per-character profile
  2. Registered default (set via SetDefault)
  3. Caller-supplied default argument

API

Read

---@param key string
---@param default? any
---@return any value
Config:Read(key, default)
Reads a config value using the fallback chain. Refreshes the cache first, so character switches are picked up automatically.

Write

---@param key string
---@param value any
---@return boolean saved
Config:Write(key, value)
Sets the key in the in-memory cache and persists the entire profile to disk immediately (JSON-encoded). Returns true only when WGG accepts the file write.

SetDefault

---@param key string
---@param value any
Config:SetDefault(key, value)
Registers an in-memory fallback default. SetDefault does not write unset defaults to disk; a key appears in the profile JSON only after Config:Write persists it. GUI builder widgets call this automatically for every keyed widget.

GetAll

---@return table settings
Config:GetAll()
Returns a shallow copy of all stored settings for the active profile (excluding function/userdata values). Empty table when no profile exists.

ClearCache

Config:ClearCache()
Resets the profile cache so the next access reloads from disk.

Example

volvox.Config:SetDefault("myfeature.threshold", 25)

local threshold = volvox.Config:Read("myfeature.threshold")      -- 25
volvox.Config:Write("myfeature.threshold", 40)                   -- persisted immediately
local all = volvox.Config:GetAll()                               -- stored settings only
The status toggle frame (volvox:AddGlobalToggle) uses its own persistence file, scripts/LootRoute/DemonStatusFrame.json, independent of volvox.Config, with legacy read fallbacks from scripts/Gatherer/DemonStatusFrame.json and configs/Demon/DemonStatusFrame.json.