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
local items = {}export function items() return {}endlocal itemList = {}export function items() return itemListendThe 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)
Related codes
| code | message |
|---|---|
| E0118 | export function with a dotted or method name |
Offline
$ wowlua explain E1016 E1016 (error): An export redeclares a module-level name (a local, function, import, …), or a name is exported twice