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
export const VERSION = 1return VERSIONexport const VERSION = 1The 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
$ wowlua explain E1032 E1032 (error): Top-level return in a module