errors and warnings / names / E1011
E1011 error
Top-level import after another (non-import) statement
- area
- names (x1xxx)
- fails the build
- yes
- in plain Lua files
- reported as W1011
A top-level import comes after another statement. Imports must come first
in a module, before any other statement (comments and --! directives may
precede them). Move every import to the top of the file.
Example
local delay = 1import after from "wowlua:timer"after(delay, function() print("later") end)import after from "wowlua:timer"local delay = 1after(delay, function() print("later") end)The compiler reports it like this:
error[E1011]: imports must come before every other statement ┌─ src/main.wowlua:2:1 │ 2 │ import after from "wowlua:timer" │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ this import follows other code
Related codes
| code | message |
|---|---|
| E0108 | import / export not at the top level of a module |
Offline
$ wowlua explain E1011 E1011 (error): Top-level import after another (non-import) statement