diff --git a/functions.lua b/functions.lua index e8e4789..8a5517c 100644 --- a/functions.lua +++ b/functions.lua @@ -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