v0.13.8
errors and warnings / parsing

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

× failswowlua
local hp = UnitHealth("player")if hp > 0    print(hp)end
✓ compileswowlua
local hp = UnitHealth("player")if hp > 0 then    print(hp)end

The compiler reports it like this:

error[E0101]: 'then' expected near 'print'
  ┌─ src/main.wowlua:3:5
  │
3 │     print(hp)
  │     ^^^^^ here
codemessage
E0102Unterminated string or long bracket
E0104Ambiguous syntax (function call vs. new statement), as in Lua 5.1

Offline

terminal
$ wowlua explain E0101
E0101 (error): Unexpected token

source on GitHub ↗