Inventory.opIndex

Gets the slot at the given index.

  1. Slot[] opIndex()
  2. Slot opIndex(size_t index)
    class Inventory
    @safe
    opIndex
    (
    size_t index
    )
  3. InventoryRange opIndex(Slice slice)

Parameters

index size_t

a number in range 0..$

Return Value

Type: Slot

the slot at the given index

Throws

RangeError if an invalid index is given

Examples

if(!inventory[1].empty && inventory[1].item == Items.APPLE) { ... }

Meta