v0.13.7
errors and warnings / types

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

× failswowlua
local function add(a: number, b: number): number    return a + bendprint(add(1, 2, 3))
✓ compileswowlua
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
codemessage
W2055Too many arguments to an unannotated function (basic mode). Replaces the second meaning of W2006.
E2007Missing argument
E2012No overload matches the call

Offline

terminal
$ wowlua explain E2006
E2006 (error): Too many arguments

source on GitHub ↗