@param parameter type annotation

Note

Use @param to specify the types of function parameters, to improve completions and other functionality.

../_images/param1.gif
  • Full format:
---@param param_name MY_TYPE[|other_type] [@comment]
  • Target:

    • function parameters
    1
    2
    3
    4
    ---@param car Car
    local function setCar(car)
        ...
    end
    
    1
    2
    3
    4
    ---@param car Car
    setCallback(function(car)
        ...
    end)
    
    • for loop variables
    1
    2
    3
    ---@param car Car
    for k, car in ipairs(list) do
    end
    
Fork me on GitHub