----- Original Message -----
From: "Daniel Stephens"
Actually, the problem is that your sort function is invalid, it doesn't
follow the correct contract:
He stated quite clearly in his original post that he's aware that his sort
function is invalid. His question was why does Lua call the function with
nil values, when it has a nice error message "invalid order function for
sorting", that apparently due to a bug it does not use. Such a message would
be very useful in more complicated sort functions with larger tables, as
such an abstract nil error message might take forever to find the cause of.
If it won't damage performance, that is definitely a bug in Lua that should
be fixed.