Class GGItemCollection extends Resource

Represents a collection of inventory items and ensures that each item is a unique instance.

The main purpose of this class is to be able to create a collection of items that can be stored as a resource. This makes it easy to assign a item collection resource to a [GGInventory] component.

Items are represented by the [GGItemData] class, which extends [Resource]. Resource instances are shared by default, which is not the desired behavior since you want to have a unique instance for each copy of the same item. This is handled by the collection when it is instantiated: All of its items are ensured to be unique instances via GGItemData.copy().

This class implements a custom iterator. This allows you to iterate over the collection's items, for example, in a for loop: [codeblock] for item: GGItemData in my_item_collection: print("item: %s" % [item]) [/codeblock] Note: If this collection belongs to an [GGInventory] that allows gaps (see GGInventory.allow_gaps), it'll pad the collection's items with null values.

# Members

## Represents a list of inventory items. The array may also contain [code]null[/code] entries, but only if [member GGInventory.allow_gaps] is enabled.
var items: GGItemData[] = []

# Methods

## The size of the [member items] array.
func size() -> int
## Counts the number of items in the [member items] array.
func count() -> int