array type

Note

Use MY_TYPE[] to specify that a variable’s type is an array type

  • Full format:
---@type MY_TYPE[]
  • Examples:

    1
    2
    3
    4
    5
    6
    7
    8
    9
    ---@type Car[]
    local list = {}
    
    local car = list[1]
    -- car. and you'll see completion
    
    for i, car in ipairs(list) do
        -- car. and you'll see completion
    end
    
Fork me on GitHub