v0.13.7
errors and warnings / types

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

× failswowlua
local count: number = 3count()
✓ compileswowlua
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
codemessage
W2004Value is not callable (in a plain Lua file)
E2008Method called without self (use :)

Offline

terminal
$ wowlua explain E2004
E2004 (error): Value is not callable

source on GitHub ↗