v0.13.6
errors and warnings / names

errors and warnings / names / E1010

E1010 error

Assignment to an exported or imported binding

area
names (x1xxx)
fails the build
yes
in plain Lua files
reported as W1010

The code assigns to an exported local after its declaration, or to an imported name. Importers copy an export once while the file loads, so a later assignment would never reach them; exported and imported bindings are therefore read-only. Change a table's contents instead (state.count += 1), or export functions that read and change the value.

Example

× failswowlua
export local count = 0count = count + 1
✓ compileswowlua
export local state = { count = 0 }state.count = state.count + 1

The compiler reports it like this:

error[E1010]: cannot assign to the exported binding `count`; mutate a table's contents or export accessor functions
  ┌─ src/main.wowlua:2:1
  │
2 │ count = count + 1
  │ ^^^^^ here
codemessage
E2010Assignment to a const, readonly field, read-only accessor, enum member or wowlua:meta field
E0119export local without an initializer

Offline

terminal
$ wowlua explain E1010
E1010 (error): Assignment to an exported or imported binding

source on GitHub ↗