Skip to content

Add a shortcut annotation for adding a nil,string return type to functions (@error) #3156

@piotrp

Description

@piotrp

Returning of errors from Lua functions is often done by returning nil + error message (nil,string):

---@return table
---@overload fun(): nil, string
local function doSomething()

but this syntax can get complex when function takes parameters, or has other overloads. An old solution from LDoc was to use a @error annotation - I propose to add something similar to LuaLS.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions