File utils/inventoryutil.lua
Functions
inventoryutil.difference_hash (inventory, name, hash) | Gets the difference between the given inventory and the hash. |
inventoryutil.equals_hash (inventory, name, hash, true) | Test if the given inventory equals the given hash. |
inventoryutil.hash (inventory, name) | Creates a hash for the given inventory. |
Functions
- inventoryutil.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.
Return value:
The difference between the inventory and the hash. - inventoryutil.equals_hash (inventory, name, hash, true)
-
Test if the given inventory equals the given hash.
Parameters
- inventory: The InvRef object.
- name: The name of the inventory.
- hash: The hash.
- true: If the inventory equals the hash.
- inventoryutil.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.
Return value:
The hash.