Module inventoryutil
A util for working with inventories.
Functions
difference_hash (inventory, name, hash) | Gets the difference between the given inventory and the hash. |
equals_hash (inventory, name, hash) | Test if the given inventory equals the given hash. |
hash (inventory, name) | Creates a hash for the given inventory. |
Functions
- difference_hash (inventory, name, hash)
-
Gets the difference between the given inventory and the hash. The difference
is returned in the same format as the hash, with the count being
the amount of difference.
Parameters:
- inventory The InvRef object.
- name The inventory name.
- hash The hash to compare against.
Returns:
-
The difference between the inventory and the hash.
- equals_hash (inventory, name, hash)
-
Test if the given inventory equals the given hash.
Parameters:
- inventory The InvRef object.
- name The name of the inventory.
- hash The hash.
Returns:
-
true If the inventory equals the hash.
- hash (inventory, name)
-
Creates a hash for the given inventory.
The hash is a 2D table containing the ID and the stack count of all items.
Parameters:
- inventory The InvRef object.
- name The name of the inventory.
Returns:
-
The hash.