Module iter
Iterationeering functions.
The positional iterators are all dlua only and iterate over regions in dungeon grid coordinates.
Class iter.invent_iterator
iter.invent_iterator:check_filter (item) | Check an item agains the iterator's filter |
iter.invent_iterator:inventory_iterator () | An easier and more posh way of interfacing with inventory. |
iter.invent_iterator:new (itable[, filter[, rv_instead=false]]) | Create a new inventory iterator |
iter.invent_iterator:next () | Advance the iterator |
Class iter.invent_iterator
Inventory iterator.
Iterates over tables of items.Item objects, possibly filtering them.
Usage:
for item in iter.invent_iterator()
if item.is_useless then
item:drop()
end
end
- iter.invent_iterator:check_filter (item)
-
Check an item agains the iterator's filter
Parameters:
- item
Returns:
-
either the item or filter(item) if rv is asked for
- iter.invent_iterator:inventory_iterator ()
- An easier and more posh way of interfacing with inventory.
- iter.invent_iterator:new (itable[, filter[, rv_instead=false]])
-
Create a new inventory iterator
Parameters:
- itable the inventory table
- filter filter function (optional)
- rv_instead return the rv of the filter instead (default false)
- iter.invent_iterator:next ()
- Advance the iterator