v0.13.7
errors and warnings / names

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

× failswowlua
local delay = 1import after from "wowlua:timer"after(delay, function() print("later") end)
✓ compileswowlua
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
codemessage
E0108import / export not at the top level of a module

Offline

terminal
$ wowlua explain E1011
E1011 (error): Top-level import after another (non-import) statement

source on GitHub ↗