errors and warnings / names / W1002
W1002 warning
Implicit global assignment (basic mode)
- area
- names (x1xxx)
- fails the build
- with --deny-warnings
The code assigns a global that isn't declared (see E1002). It is a warning in
basic mode, the default, and in plain Lua files; strict mode makes it the
error E1002. If the global is meant to exist (a SavedVariable, an API for
other addons), declare it or write _G.name = value; otherwise make it
local.
Example
counter = 0local counter = 0print(counter)The compiler reports it like this:
warning[W1002]: assigns the undeclared global `counter` (declare it, use `_G.counter`, or make it `local`) ┌─ src/main.wowlua:1:1 │ 1 │ counter = 0 │ ^^^^^^^ here
Related codes
Offline
$ wowlua explain W1002 W1002 (warning): Implicit global assignment (basic mode)