Returns a proper serial-comma-separated string list of the list elements' toString() values, including “and”, or “nothing” if the list is empty.
// Returns "a two-dollar pistol, a Stetson hat, and a shotgun": [ "a two-dollar pistol", "a Stetson hat", "a shotgun" ].commaList() // Returns "a two-dollar pistol and a Stetson hat": [ "a two-dollar pistol", "a Stetson hat" ].commaList() // Returns "a two-dollar pistol": [ "a two-dollar pistol" ].commaList() // Returns "nothing": [].commaList()
As above, but with the first letter of the returned string capitalized.
Assuming an array of PersistentObjects (or subclasses thereof) or persistent object IDs (may be mixed), returns a serial-comma-separated description like .commaList(), but using those objects' .aName methods.
// Assuming pistol and shotgun are valid PersistentObjects, and "hat" is the id of a valid // PersistentObject, returns "a two-dollar pistol, a Stetson hat, and a shotgun": [ pistol, "hat", shotgun ].aList()
As above, but with the first letter of the returned string capitalized.
Assuming an array of PersistentObjects (or subclasses thereof) or persistent object IDs (may be mixed), returns a serial-comma-separated description like .commaList(), but using those objects' .theName methods.
// Assuming pistol and shotgun are valid PersistentObjects, and "hat" is the id of a valid // PersistentObject, returns "the two-dollar pistol, the Stetson hat, and the shotgun": [ pistol, "hat", shotgun ].theList()
As above, but with the first letter of the returned string capitalized.
Assuming an array of PersistentObjects (or subclasses thereof), or persistent object IDs, or functions (may be mixed), returns a serial-comma-separated description like .commaList(), but using those objects' .name fields. Useful for things like “your such-and-suches”.
// Assuming pistol and shotgun are valid PersistentObjects, and "hat" is the id of a valid // PersistentObject, returns "two-dollar pistol, Stetson hat, and shotgun": [ pistol, "hat", shotgun ].theList()
As above, but with the first letter of the returned string capitalized.