errors and warnings / types / E2006
E2006 error
Too many arguments
- area
- types (x2xxx)
- fails the build
- yes
- in plain Lua files
- reported as W2006
A call passes more arguments than the function takes. Lua would drop the
extra ones silently, which usually hides a mistake: a wrong function, or
arguments in the wrong order. Remove the extra arguments, or add the
parameters (...: T for any number of them).
For a function with no annotations at all, basic mode reports the warning W2055 instead; strict mode reports E2006 for every function.
Example
local function add(a: number, b: number): number return a + bendprint(add(1, 2, 3))local function add(a: number, b: number): number return a + bendprint(add(1, 2))The compiler reports it like this:
error[E2006]: too many arguments: expected 2, got 3 ┌─ src/main.wowlua:4:17 │ 4 │ print(add(1, 2, 3)) │ ^ here
Related codes
| code | message |
|---|---|
| W2055 | Too many arguments to an unannotated function (basic mode). Replaces the second meaning of W2006. |
| E2007 | Missing argument |
| E2012 | No overload matches the call |
Offline
$ wowlua explain E2006 E2006 (error): Too many arguments