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
{ "package": { "name": "playground", "version": "0.1.0", "wowlua": "^0.13" }, "flavors": { "camelot": {} }, "addon": { "saved-variables": ["MyAddonDB"] }}import * as saved from "wowlua:saved"local db = saved.bind("MyAddonDB", { version = 1, defaults = { scale = 1 }, profiles = true })print(db){ "package": { "name": "playground", "version": "0.1.0", "wowlua": "^0.13" }, "flavors": { "camelot": {} }, "addon": { "saved-variables": ["MyAddonDB"], "saved-variables-per-character": ["MyAddonDBPerChar"] }}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`
Related codes
| code | message |
|---|---|
| E8020 | saved.bind on a SavedVariable not declared in the manifest |
| E8117 | profiles = true on a per-character SavedVariable |
Offline
$ wowlua explain E8021 E8021 (error): Profiles enabled without the per-character profile SavedVariable (<name>PerChar)