list.count
Counts the items in a list.
Signature
list.count(ref: ElementRef, key: string): number
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
ref | ElementRef | Required | The element it works on, usually self. |
key | string | Required | The name of the list. |
Returns
number How many there are.
Example
if (list.count(self, "pack") < 2) {
list.add(self, "pack", trinket, offer.where({ weight: { lte: 3 } }));
}
