v0.13.8
errors and warnings / stdlib

errors and warnings / stdlib / E8102

E8102 error

saved.bind name is not a string literal

area
stdlib (x8xxx)
fails the build
yes

saved.bind takes the SavedVariable's name as a string literal, so the compiler can check it against the manifest (E8020) and make sure it is bound only once (E8103). A variable or any other expression can't be checked.

Write the name directly in the call.

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 name = "MyAddonDB"local db = saved.bind(name, { version = 1, defaults = {} })print(db)
✓ compileswowlua.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 = {} })print(db)

The compiler reports it like this:

error[E8102]: `saved.bind` needs the SavedVariable's name as a string literal
  ┌─ src/main.wowlua:3:23
  │
3 │ local db = saved.bind(name, { version = 1, defaults = {} })
  │                       ^^^^ not a literal
codemessage
E8020saved.bind on a SavedVariable not declared in the manifest
E8103SavedVariable bound twice with saved.bind

Offline

terminal
$ wowlua explain E8102
E8102 (error): saved.bind name is not a string literal

source on GitHub ↗