v0.13.7
errors and warnings / parsing

errors and warnings / parsing / E0107

E0107 error

continue in a repeat loop whose until condition uses a body local

area
parsing (x01xx)
fails the build
yes

continue is used in a repeat … until cond loop whose condition reads a local declared in the loop body. Lua 5.1 has no goto, so wowlua wraps the body in an inner loop to implement continue, and the body's locals would no longer be visible to until. Declare the local before the loop and assign it in the body, or use another kind of loop.

Example

× failswowlua
local i = 0repeat    i += 1    local finished = i >= 10    if i % 2 == 0 then continue end    print(i)until finished
✓ compileswowlua
local i = 0local finished = falserepeat    i += 1    finished = i >= 10    if i % 2 == 0 then continue end    print(i)until finished

The compiler reports it like this:

error[E0107]: `continue` cannot be used in this `repeat` loop: its `until` condition uses the body local `finished`
  ┌─ src/main.wowlua:7:7
  │
7 │ until finished
  │       ^^^^^^^^ here
codemessage
E0114continue is not the last statement of its block

Offline

terminal
$ wowlua explain E0107
E0107 (error): continue in a repeat loop whose until condition uses a body local

source on GitHub ↗