@return function return type annotation¶
Note
Use @return
to specify the return type of a function

- Full format:
---@return MY_TYPE[|OTHER_TYPE] [@comment]
Target:
- functions
1 2 3 4 5 6 7
---@return Car|Ship local function create() ... end ---Here car_or_ship doesn't need @type annotation, EmmyLua has already inferred the type via "create" function local car_or_ship = create()
1 2 3 4
---@return Car function factory:create() ... end