14.02.2022, 14:07
(14.02.2022, 14:02)admin Wrote: Since you have [0] index in the table it is not treated as an array (index 1..n) so it cannot be sorted. You can convert it to array like this:
Code:tbl_price = storage.get('NordPool_prices') -- Get prize from Nordpool arr_price = {} for _, row in pairs(tbl_price) do arr_price[ #arr_price + 1 ] = row end table.sort(arr_price, function(a, b) return a['price_total'] > b['price_total'] end) log(arr_price)
YOU ARE A LIFESAVER :-)!!