v0.13.7
errors and warnings / stdlib

errors and warnings / stdlib / E8070

E8070 error

Settings control bound to a field of the wrong type

area
stdlib (x8xxx)
fails the build
yes

A wowlua:settings control is bound to a store field of a type it can't edit. A checkbox needs a boolean field, a slider a number field and a color a { r: number, g: number, b: number, a: number? } field. The compiler checks each control in the controls list against the type of store (what saved.bind returns). Use the control that fits the field, or change the field's default value to the type the control needs.

Example

× failswowlua.jsonjson
{    "package": { "name": "playground", "version": "0.1.0", "wowlua": "^0.13" },    "flavors": { "camelot": {} },    "addon": { "saved-variables": ["PlaygroundDB"] }}
src/main.wowluawowlua
import * as settings from "wowlua:settings"import * as saved from "wowlua:saved" local db = saved.bind("PlaygroundDB", { version = 1, defaults = { scale = 1, locked = false } }) settings.register({    title = "Playground",    store = db,    controls = { settings.checkbox("scale", { label = "Scale" }) },})
✓ compileswowlua.jsonjson
{    "package": { "name": "playground", "version": "0.1.0", "wowlua": "^0.13" },    "flavors": { "camelot": {} },    "addon": { "saved-variables": ["PlaygroundDB"] }}
src/main.wowluawowlua
import * as settings from "wowlua:settings"import * as saved from "wowlua:saved" local db = saved.bind("PlaygroundDB", { version = 1, defaults = { scale = 1, locked = false } }) settings.register({    title = "Playground",    store = db,    controls = {        settings.slider("scale", { label = "Scale", min = 0.5, max = 2, step = 0.1 }),        settings.checkbox("locked", { label = "Lock frame" }),    },})

The compiler reports it like this:

error[E8070]: `scale` is `number`; a checkbox needs `boolean`
  ┌─ src/main.wowlua:9:36
  │
9 │     controls = { settings.checkbox("scale", { label = "Scale" }) },
  │                                    ^^^^^^^ here
codemessage
E8113Settings control key not found in the store's type
E8107Settings dropdown option value not in the field's type

Offline

terminal
$ wowlua explain E8070
E8070 (error): Settings control bound to a field of the wrong type

source on GitHub ↗