errors and warnings / classes / E3007
E3007 error
Metamethod on a widget class
- area
- classes (x3xxx)
- fails the build
- yes
A widget class (a class that extends a frame type such as Frame or Button)
defines a metamethod such as __tostring or __eq. The frame's metatable
belongs to WoW, so a widget class can't have metamethods. Use an ordinary
method instead.
Example
class Tile extends Frame function __tostring(): string return "tile" endendprint(Tile)class Tile extends Frame function describe(): string return "tile" endendprint(Tile)The compiler reports it like this:
error[E3007]: widget class `Tile` cannot define the metamethod `__tostring` ┌─ src/main.wowlua:2:14 │ 2 │ function __tostring(): string │ ^^^^^^^^^^ the frame's metatable belongs to WoW
Related codes
Offline
$ wowlua explain E3007 E3007 (error): Metamethod on a widget class