LibSharedVariables

Shared account and per-character saved variables with a merged proxy view.

File Details

LibSharedVariables-1.0

  • R
  • Mar 23, 2026
  • 3.12 KB
  • 14
  • 2.5.5+1
  • Classic + 1

File Name

LibSharedVariables-1.0.zip

Supported Versions

  • 2.5.5
  • 1.15.8

Changelog

[1.0.0] - 23/03/2026

Added

  • Initial release of LibSharedVariables-1.0.
  • Library registration through LibStub as major LibSharedVariables-1.0 with minor 1.
  • Main API: lib:Load(name, defaults, defaultsPC, onLoad) returning a reusable handle per addon name.
  • Automatic saved variable table creation in _G for <name>DB (account-wide) and <name>PCDB (per-character).
  • Merged proxy database view at handle.db with prioritized lookup: Character DB -> Account DB -> Character defaults (defaultsPC) -> Account defaults (defaults).
  • Smart write routing in handle.db: existing character keys stay character-scoped; keys in defaultsPC persist to character DB; keys in defaults persist to account DB; new keys default to character DB.
  • Utility methods: handle:Get(key, default) and handle:Set(key, value).
  • Merged iteration support via pairs(handle.db) with duplicate key suppression and precedence-aware order.
  • Argument validation for name (non-empty string) and onLoad (function when provided).
  • Handle reuse behavior when Load is called multiple times with the same name, including refresh of DB references and defaults.
  • Optional onLoad(db, handle) callback invoked on first handle creation.

Compatibility

  • Interface values declared in TOC: 11508, 20505.
  • Requires LibStub (LibStub/LibStub.lua).
  • Load-on-demand library (## LoadOnDemand: 1).
  • Lua addon environment for World of Warcraft saved variables.

Notes

  • This is the first public build for the library.
  • Versioning follows LibStub major/minor conventions, mapped to changelog release 1.0.0.
  • The design targets predictable data ownership between account and character scopes while keeping access through a single merged db view.
  • Licensed under GPL-3.0 (see LICENSE).