Inventory.opCast

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.

class Inventory
@safe
T
opCast
(
T
)
()
if (
is(T == Slot[])
)

Return Value

Type: T

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