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
local i = 0repeat i += 1 local finished = i >= 10 if i % 2 == 0 then continue end print(i)until finishedlocal i = 0local finished = falserepeat i += 1 finished = i >= 10 if i % 2 == 0 then continue end print(i)until finishedThe 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
Related codes
| code | message |
|---|---|
| E0114 | continue is not the last statement of its block |
Offline
$ wowlua explain E0107 E0107 (error): continue in a repeat loop whose until condition uses a body local