v0.13.7
errors and warnings / stdlib

errors and warnings / stdlib / E8021

E8021 error

Profiles enabled without the per-character profile SavedVariable (<name>PerChar)

area
stdlib (x8xxx)
fails the build
yes

saved.bind with profiles = true keeps the active profile of each character in a second, per-character SavedVariable named after the first with PerChar appended (MyAddonDB uses MyAddonDBPerChar). That variable isn't declared, so the profile choice would be lost at logout.

Add <name>PerChar to addon.saved-variables-per-character in wowlua.json.

Example

× failswowlua.jsonjson
{    "package": { "name": "playground", "version": "0.1.0", "wowlua": "^0.13" },    "flavors": { "camelot": {} },    "addon": { "saved-variables": ["MyAddonDB"] }}
src/main.wowluawowlua
import * as saved from "wowlua:saved"local db = saved.bind("MyAddonDB", { version = 1, defaults = { scale = 1 }, profiles = true })print(db)
✓ compileswowlua.jsonjson
{    "package": { "name": "playground", "version": "0.1.0", "wowlua": "^0.13" },    "flavors": { "camelot": {} },    "addon": {        "saved-variables": ["MyAddonDB"],        "saved-variables-per-character": ["MyAddonDBPerChar"]    }}
src/main.wowluawowlua
import * as saved from "wowlua:saved"local db = saved.bind("MyAddonDB", { version = 1, defaults = { scale = 1 }, profiles = true })print(db)

The compiler reports it like this:

error[E8021]: profiles keep the active profile in `MyAddonDBPerChar`: add it to `addon.saved-variables-per-character`
  ┌─ src/main.wowlua:2:23
  │
2 │ local db = saved.bind("MyAddonDB", { version = 1, defaults = { scale = 1 }, profiles = true })
  │                       ^^^^^^^^^^^ needs `PerChar`
codemessage
E8020saved.bind on a SavedVariable not declared in the manifest
E8117profiles = true on a per-character SavedVariable

Offline

terminal
$ wowlua explain E8021
E8021 (error): Profiles enabled without the per-character profile SavedVariable (<name>PerChar)

source on GitHub ↗