Inventory.opIndex

Gets every slots of the inventory (0..$). This property should only be used when the full inventory is needed, otherwise opIndex should be used for getting a slot in a specific index or in a specific range.

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

Return Value

Type: Slot[]

an array with every slot in the inventory

Examples

auto inventory = new Inventory(2);
assert(inventory[] == [Slot(null), Slot(null)]);
assert(cast(Slot[])inventory == inventory[]);

Meta