Class: Wardrobe

.Apparel. Wardrobe

This class, derived from GeneralInventory, is meant to contain Apparel, although it can contain any PersistentObject. It overrides sort() so that the contents are sorted in order of ClothingSlot value rather than alphabetically, with any non-Apparel items listed last.

new Wardrobe(id)

You should never instantiate a PersistentObject directly! Instead, you must define it with PersistentObject.define(), and then instantiate it with the obj() function when you want to use it. You must also never store PersistentObjects in Sugarcube variables! Just store their ids, instantiate them with obj() as needed, and then let them be garbage-collected.

Name Type Description
id string

The id of the Persistence defaults entry to be associated with this instance.



  • LibEcho.GeneralInventory


sort(a, b)

This method is overridden, to sort by ClothingClot order, to make it read a little more nicely.

Name Type Description
a LibEcho.Persistence.PersistentObject

a PersistentObject.

b LibEcho.Persistence.PersistentObject

another PersistentObject.


0 if a's highest ClothingSlot is greater than b's lowest ClothingSlot, <0 if a's highest ClothingSlot is less than b's lowest ClothingSlot, or 0 if a's highest ClothingSlot is equal to b's lowest ClothingSlot. If a or b are not GenericApparel, then it is treated as having a slots value of [Number.MAX_SAFE_INTEGER].