errors and warnings / types / E2004
E2004 error
Value is not callable
- area
- types (x2xxx)
- fails the build
- yes
- in plain Lua files
- reported as W2004
Something is called that isn't a function: a number, a string, a table
without __call, or an unknown that hasn't been narrowed. In game this is
the "attempt to call a … value" error. Usually a name holds something other
than you think, or a field's name is wrong; narrow an unknown with
type(x) == "function" before calling it.
In a plain Lua file it is the warning W2004.
Example
local count: number = 3count()local count: number = 3print(count)The compiler reports it like this:
error[E2004]: a value of type `3` is not callable ┌─ src/main.wowlua:2:1 │ 2 │ count() │ ^^^^^^^ here
Related codes
| code | message |
|---|---|
| W2004 | Value is not callable (in a plain Lua file) |
| E2008 | Method called without self (use :) |
Offline
$ wowlua explain E2004 E2004 (error): Value is not callable