v0.13.7
errors and warnings / types

errors and warnings / types / E2059

E2059 error

Default value in a declare event / declare message parameter

area
types (x2xxx)
fails the build
yes
in plain Lua files
reported as W2059

A parameter of declare event or declare message has a default value. The parameters describe the payload the game or the sender gives, so a default has no meaning there; remove it.

Example

× failswowlua
declare message MYADDON_CHANGED(key: string = "scale")print("changed")
✓ compileswowlua
declare message MYADDON_CHANGED(key: string)print("changed")

The compiler reports it like this:

error[E2059]: the parameter `key` of the message `MYADDON_CHANGED` has a default value: the payload is what the sender gives
  ┌─ src/main.wowlua:1:47
  │
1 │ declare message MYADDON_CHANGED(key: string = "scale")
  │                                               ^^^^^^^ remove the default

Offline

terminal
$ wowlua explain E2059
E2059 (error): Default value in a declare event / declare message parameter

source on GitHub ↗