 
      
      usort()Sort an array using a user-defined comparison function
usort(data, comparison)
data (array)  — An array to be sortedcomparison (ref|function_call)  — A comparison function. The function must return a number less than, equal to, or greater than zero if the first argument is considered to be respectively less than, equal to, or greater than the second
boolean — Always returns true
import sorting
 
data = [
    {age: 20, name: "clara"},
    {age: 22, name: "vania"},
    {age: 18, name: "sarah"},
    {age: 17, name: "aisha"},
    {age: 18, name: "nifa"},
    {age: 19, name: "lisa"},
]
 
usort(data, mycompare())
 
function mycompare(a, b)
    ' Compare a.age & b.age first, and then compare a.name & b.name
    ' if both ages are equal
 
    c = compare(a.age, b.age)
 
    if c == 0
        return compare(a.name, b.name)
    else
        return c
    endif
stop