Invalid order functions
[
Date Prev][
Date Next][
Thread Prev][
Thread Next]
[
Date Index]
[
Thread Index]
- Subject: Invalid order functions
- From: Niklas Frykholm <niklas@...>
- Date: 2008年2月08日 10:59:18 +0100
If you call table.sort with an invalid sort function, you can get a call
with (nil) to the order function before you get the "invalid order
function" message
$ lua -e 'table.sort({1,2,3,4}, function (a,b) print(a,b) return true end)'
4 1
2 4
3 4
4 4
1 4
nil 4
lua: (command line):1: invalid order function for sorting
So usually you never see the "invalid order function" error message:
$ lua -e 'table.sort({1,2,3,4}, function (a,b) return a>0 end)'
lua: (command line):1: attempt to compare number with nil
Is this the intended behavior?
// Niklas