This is an old revision of the document!
Extends: PersistentObject
DESCRIPTION
STUFF
PROBABLY_NONE
Do not ever use “new” to instantiate a PersistentObject (or subclass thereof). Instead, store the result of PersistentObject.define() somewhere and reference it when needed, or fetch the object by its 'id' with PersistentObject.fetch().
Description.
Description.
Description.
Description.
Description.
Description.
Description.
Description.
Description.
Description.
Description.
Example:
FIXME
Description.
Example:
FIXME
Description.
Example:
FIXME
Description.
Example:
FIXME
Description.
Example:
FIXME
Description.
Example:
FIXME
Description.
Example:
FIXME
Description.
Example:
FIXME
Description.
Example:
FIXME
Description.
Example:
FIXME
GeneralInventory is the base Inventory implementation from which all other Inventory types are derived. It provides default functionality which can be overridden in derived classes.
An array of the id fields of all the things (PersistentObjects and subclasses) contained in this inventory. Duplicates are not allowed. Order does not matter.
This method adds the given item to the inventory. It does not remove it from any other inventories that might already contain it. You probably usually want to use InventoryUI or .move() instead.
This method removes the given item from the inventory.
This method checks to see if the inventory contains the given item.
Check if the inventory is empty.
Returns the fully-instantiated contents of the Inventory.
If a class is passed to filterClass, only items that are of that class (or a subclass thereof) will be included in the returned array.
If a function is passed to filterFunction, that function will be called once for every item in the inventory. If this function returns true, the item will be included in the returned array. If the function returns false, the item will not be included.
When not undefined, the override value sets the value that .toString() returns, ignoring the actual contents (if any) of the inventory.
This is useful for minor characters and objects who do not actually need a fully-featured inventory, as it avoids all the hassle of defining flavor objects to populate the inventory with, that the protagonist will otherwise never be able to interact with. See the Tutorial for details.
Overridden
This is the function used by .get() to sort the inventory contents. It follows the rules of Javascript's (Array).sort(). The default implementation sorts alphabetically, ignoring case.
This function is generally only used by derived classes that need to sort the {@link LibEcho.Inventory|Inventory} differently. Unless you are extending the library, you'll probably never need to use it.