Skip to main content
Docs
›
list.count

list.count

List

Counts the items in a list.

Signature

list.count(ref: ElementRef, key: string): number

Parameters

NameTypeRequiredDescription
refElementRefRequiredThe element it works on, usually self.
keystringRequiredThe 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 } }));
}