forked from Sokomine/yl_speak_up
deal with missing sort_by parameter
This commit is contained in:
parent
17a8551f25
commit
f00d7bb505
@ -1077,8 +1077,12 @@ yl_speak_up.get_sorted_options = function(options, sort_by)
|
||||
end
|
||||
table.sort(sorted_list,
|
||||
function(a,b)
|
||||
if(not(options[a][sort_by])) then
|
||||
return false
|
||||
elseif(not(options[b][sort_by])) then
|
||||
return true
|
||||
-- sadly not all entries are numeric
|
||||
if(tonumber(options[a][sort_by]) and tonumber(options[b][sort_by])) then
|
||||
elseif(tonumber(options[a][sort_by]) and tonumber(options[b][sort_by])) then
|
||||
return (tonumber(options[a][sort_by]) < tonumber(options[b][sort_by]))
|
||||
-- numbers have a higher priority
|
||||
elseif(tonumber(options[a][sort_by])) then
|
||||
|
Loading…
Reference in New Issue
Block a user