Sort a lua array


I have an array which have this form in aerospike (llist) : [{key : x, value : {date : iso_format_date, read :boolean}},etc]

I want to sort this array by date.

I tried to use a local function named ‘compare’ to compare os.time of dates that I call within table.sort (myArray,compare) where myArray corresponds to the scan of the list.

But it doesn’t work… I also tried to use ‘pairs’ when iterating the result of the scan but it seels that I didb’t understand or have missed something because all m yattempts failed .