ids
ids: (ContainerQuery, { number }) -> ContainerQueryKeep only items whose id is in the list.
itemIds- Item ids to keep.
bank:search()
player:inventory():search()
player:equipment():search()| Method | Returns | Description |
|---|---|---|
ids({ number }) | ContainerQuery | Keep only items whose id is in the list. |
named(string) | ContainerQuery | Keep only items whose whole name matches, ignoring case: | separates alternatives and * is any run of characters, so "Grimy *|Shark"… |
containing(string) | ContainerQuery | Keep only items whose name contains the text, ignoring case: | separates alternatives. |
count() | number | How many items survived the filters. Slots, not stack quantities. |
first() | ItemHandle? | The first surviving item in slot order. |
collect() | { ItemHandle } | Every surviving item, in slot order. |
| Method | Returns | Description |
|---|---|---|
Bank.search | ContainerQuery | A query over the bank's contents, live or last-known. An unseen bank reads as empty: cached() ~= nil tells the two apart. |
Equipment.search | ContainerQuery | A query over what is worn. |
Inventory.search | ContainerQuery | Open a query over the inventory's items. |
idsids: (ContainerQuery, { number }) -> ContainerQueryKeep only items whose id is in the list.
itemIdsnamednamed: (ContainerQuery, string) -> ContainerQueryKeep only items whose whole name matches, ignoring case: | separates alternatives and * is any run of characters, so "Grimy *|Shark" is every grimy herb and a shark, and "shark" is not a Raw shark.
namecontainingcontaining: (ContainerQuery, string) -> ContainerQueryKeep only items whose name contains the text, ignoring case: | separates alternatives.
text-- Part of a name: any prayer potion, any dose.
local potions = inventory:search():containing("prayer potion"):count()
-- The whole name, ignoring case: only four-dose ones.
local full = inventory:search():named("Prayer potion(4)"):count()
-- Several names: `|` separates them.
local food = inventory:search():named("Shark|Manta ray"):count()countcount: (ContainerQuery) -> numberHow many items survived the filters. Slots, not stack quantities.
firstfirst: (ContainerQuery) -> ItemHandle?The first surviving item in slot order.
nil when nothing matched.collectcollect: (ContainerQuery) -> { ItemHandle }Every surviving item, in slot order.