GetEquipmentInventoryIndexOfItemTypeBJ

Parameters
whichUnitunit
itemIdinteger
comment
bug

Leaks handle indexItem: In Jass you must set local variables that hold agents (or any child type) to null at the end of functions to avoid reference counter leaks.

patch

3.0.0.24268

Source
Blizzard.j (raise an issue to discuss on Github or submit a PR)
return type
integer
Source code
function GetEquipmentInventoryIndexOfItemTypeBJ takes unit whichUnit, integer itemId returns integer
    local integer index
    local item    indexItem

    set index = 0
    loop
        set indexItem = UnitItemInEquipmentSlot(whichUnit, ConvertLoadoutSlot(index))
        if (indexItem != null) and (GetItemTypeId(indexItem) == itemId) then
            return index + 1
        endif

        set index = index + 1
        exitwhen index >= bj_MAX_EQUIPMENT_INVENTORY
    endloop
    return 0
endfunction