Inventory.opBinary

Matches the first occurence and returns the pointer to the slot. Paramenter types: string = checks for an item with the same name string[] = checks for an item with one of the names in the array Item = checks for an item with the same name and properties (custom name, enchantments, ...) Slot = checks for the item (see above) and the count of the item

  1. Inventory opBinary(Slot[] slots)
  2. Inventory opBinary(Inventory inventory)
  3. Inventory opBinary(Slot slot)
  4. Slot* opBinary(T item)
    class Inventory
    @trusted
    opBinary
    (
    string op
    T
    )
    ()
    if (
    op == "in" &&
    (
    is(T == Slot) ||
    is(T : Item)
    ||
    is(T == string)
    ||
    is(T == string[])
    ||
    is(T == immutable(string)[])
    )
    )

Return Value

Type: Slot*

a pointer to first occurence found, or null if no occurences were found

Examples

// check for an empty slot
if(Slot(null) in inventory) {
  d("there's space!");
}

Meta

Standards

Use "Slot(null) in inventory" to check for an empty slot.