errors and warnings / parsing / E0101
E0101 error
Unexpected token
- area
- parsing (x01xx)
- fails the build
- yes
The parser met a token it can't use at that point: a missing then, do,
end or closing parenthesis, a stray operator, or ... outside a vararg
function. The message names what was expected and the token found instead
("near ''" means the file ended too early). WoW would refuse to load the
file with the same Lua syntax error, so it is an error in every file.
The same code is reported for wowlua syntax (a type annotation, +=, ?.,
…) in a .lua file, which stays plain Lua 5.1: rename the file to .wowlua,
or write the code in Lua.
Example
local hp = UnitHealth("player")if hp > 0 print(hp)endlocal hp = UnitHealth("player")if hp > 0 then print(hp)endThe compiler reports it like this:
error[E0101]: 'then' expected near 'print' ┌─ src/main.wowlua:3:5 │ 3 │ print(hp) │ ^^^^^ here
Related codes
| code | message |
|---|---|
| E0102 | Unterminated string or long bracket |
| E0104 | Ambiguous syntax (function call vs. new statement), as in Lua 5.1 |
Offline
$ wowlua explain E0101 E0101 (error): Unexpected token