errors and warnings / types / E2007
E2007 error
Missing argument
- area
- types (x2xxx)
- fails the build
- yes
- in plain Lua files
- reported as W2007
A call leaves out an argument for a parameter that isn't optional: its type
has no ? or nil and it has no default. Pass the value, or make the
parameter optional (b: number?, or a default b: number = 0) if leaving it
out is meant. In basic mode passing an explicit nil is accepted, but leaving
the argument out is still E2007.
Example
local function add(a: number, b: number): number return a + bendprint(add(1))local function add(a: number, b: number?): number return a + (b or 0)endprint(add(1))The compiler reports it like this:
error[E2007]: missing argument `b` of type `number` ┌─ src/main.wowlua:4:7 │ 4 │ print(add(1)) │ ^^^^^^ here
Related codes
| code | message |
|---|---|
| E2006 | Too many arguments |
Offline
$ wowlua explain E2007 E2007 (error): Missing argument