@class class declaration annotation¶
Note
EmmyLua use @class
to simulate classes in OOP, supporting inheritance and fields

- Full format:
--@class MY_TYPE[:PARENT_TYPE] [@comment]
Target:
- local variables
- global variables
Examples:
1 2 3 4 5
---@class Car : Transport @define class Car extends Transport local cls = class() function cls:test() end
Descriptions:
Sepcifies variable
cls
is classCar
, so we can use@type
to specify other variables’ types as Car, which can improve completion and other functionality.
See also