Returns a list of keys sorted based on values of those keys.
For normal sorting see table.sort.
Example usage of the function.