errors and warnings / stdlib / E8103
E8103 error
SavedVariable bound twice with saved.bind
- area
- stdlib (x8xxx)
- fails the build
- yes
The same SavedVariable is bound with saved.bind twice in the addon. Each
binding would load, fill with defaults and strip the same data on its own, so
the two tables would fight over it.
Bind it once, in one module, and export the returned table to the modules that need it.
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 = {} })local again = saved.bind("MyAddonDB", { version = 1, defaults = {} })print(db, again){ "package": { "name": "playground", "version": "0.1.0", "wowlua": "^0.13" }, "flavors": { "camelot": {} }, "addon": { "saved-variables": ["MyAddonDB"] }}import * as saved from "wowlua:saved"export const db = saved.bind("MyAddonDB", { version = 1, defaults = {} })import db from "/db"print(db)The compiler reports it like this:
error[E8103]: `MyAddonDB` is bound twice ┌─ src/main.wowlua:3:15 │ 2 │ local db = saved.bind("MyAddonDB", { version = 1, defaults = {} }) │ ------------------------------------------------------- first bound here 3 │ local again = saved.bind("MyAddonDB", { version = 1, defaults = {} }) │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ again
Related codes
| code | message |
|---|---|
| E8020 | saved.bind on a SavedVariable not declared in the manifest |
| E8102 | saved.bind name is not a string literal |
Offline
$ wowlua explain E8103 E8103 (error): SavedVariable bound twice with saved.bind