v0.13.7
errors and warnings / names

errors and warnings / names / E1016

E1016 error

An export redeclares a module-level name (a local, function, import, …), or a name is exported twice

area
names (x1xxx)
fails the build
yes
in plain Lua files
reported as W1016

An export has the name of another top-level declaration of the module (a local, function, const, class, enum or import), or a name is exported twice. An export is itself a module-level local, so the two would shadow each other. Rename one of them, or put export on the original declaration. Declarations that @if removes from the build don't count, so alternatives for different flavors may share a name.

Example

× failswowlua
local items = {}export function items()    return {}end
✓ compileswowlua
local itemList = {}export function items()    return itemListend

The compiler reports it like this:

error[E1016]: the export `items` redeclares a module-level name
  ┌─ src/main.wowlua:2:17
  │
1 │ local items = {}
  │       ----- also declared here
2 │ export function items()
  │                 ^^^^^ exported here
  │
  = help: an export is a module-level local of its own, so the two shadow each other and code meant for one reads the other: rename one of them (an export needs no forward declaration, it is hoisted)
codemessage
E0118export function with a dotted or method name

Offline

terminal
$ wowlua explain E1016
E1016 (error): An export redeclares a module-level name (a local, function, import, …), or a name is exported twice

source on GitHub ↗