Chapter 11: Page 199 - 'Sorting the Player's Inventory'

In this section, the function itemNameSort should really be called compareItemName and the text should be updated to reflect this. The implementation of the function should be as follows:

 function compareItemName(a, b)
   if < then
     return true
     return false

While this code is equivalent to the existing itemNameSort definition, the concepts of custom comparison functions introduced in Chapter 5 should be reinforced here. The name of the function was confusing, and it was not clear enough in the shorter example what the function was actually doing.