v0.13.8
errors and warnings / names

errors and warnings / names / E1032

E1032 error

Top-level return in a module

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

A module (a file with an import or export) has a return at its top level. Exports after it would never be assigned, and WoW ignores a file's return value anyway. Remove the return; to share values, export them. A script (a file without imports and exports) may still return, as in Lua.

Example

× failswowlua
export const VERSION = 1return VERSION
✓ compileswowlua
export const VERSION = 1

The compiler reports it like this:

error[E1032]: a module cannot `return` at its top level
  ┌─ src/main.wowlua:2:1
  │
2 │ return VERSION
  │ ^^^^^^^^^^^^^^ exports after this would never be assigned

Offline

terminal
$ wowlua explain E1032
E1032 (error): Top-level return in a module

source on GitHub ↗