errors and warnings / names / E1001
E1001 error
Undefined global read (strict mode)
- area
- names (x1xxx)
- fails the build
- yes
- in plain Lua files
- reported as W1001
In strict mode, the code reads a global that nothing declares: no WoW API,
Lua library, declare global, SavedVariable from the manifest,
check.globals entry, or global that a file of the package assigns. Most
often it is a typo or a missing local; in game the read gives nil and
fails later with "attempt to call/index a nil value". Fix the name, make it
a local or an import, or declare the global (declare global name: T).
Strict mode comes from --!strict or the manifest (check.mode,
check.strict). In basic mode, the default, the same read is the warning
W1001. An existence test (if SomeApi then … end) never reports the tested
name.
Example
--!strictlocal playerName = UnitName("player")print(playerNmae)--!strictlocal playerName = UnitName("player")print(playerName)The compiler reports it like this:
error[E1001]: `playerNmae` is not a declared global ┌─ src/main.wowlua:3:7 │ 3 │ print(playerNmae) │ ^^^^^^^^^^ here
Related codes
Offline
$ wowlua explain E1001 E1001 (error): Undefined global read (strict mode)