Lua table sort claims invalid order function for sorting

I currently have a large program in LuaTeX (which is a TeX engine with a built-in lua interpreter), and a table is sorted in one part of the program. Table elements themselves are tables with a specific structure, and the sort function looks like this:

function sort_list_function (a,b)

  if a.totalfilll < b.totalfilll then
    return true
  elseif a.totalfill < b.totalfill then
    return true
  elseif a.totalfil < b.totalfil then
    return true
  elseif a.totalvalue + a.height + a.totalplus <
         b.totalvalue + b.height + b.totalplus
  then   
    return true
  else
    return false
  end       
end

All element values ​​are numbers, therefore, in my opinion, the requirement for the comparison function is met, but maybe my thinking is turned off (which is basically a question, that is, why or under what circumstances the above result may be invalid order function error) .

, , , , , , , - , .

+4
1

ok, @ColonelThirtyTwo, , , >, false ( ), , -

  if a.totalfilll < b.totalfilll then
    return true
  elseif a.totalfilll > b.totalfilll then
    return false
  elseif a.totalfill < b.totalfill then
    return true
  elseif a.totalfill > b.totalfill then
    return false
  elseif a.totalfil < b.totalfil then
    return true
  elseif a.totalfil > b.totalfil then
    return false
  else
    return ( a.totalvalue + a.height + a.totalplus <
             b.totalvalue + b.height + b.totalplus    )
  end   
+4

All Articles