aboutsummaryrefslogtreecommitdiff
path: root/fuzzel.lua
diff options
context:
space:
mode:
Diffstat (limited to 'fuzzel.lua')
-rw-r--r--fuzzel.lua10
1 files changed, 5 insertions, 5 deletions
diff --git a/fuzzel.lua b/fuzzel.lua
index f3432dc..894fd07 100644
--- a/fuzzel.lua
+++ b/fuzzel.lua
@@ -223,17 +223,17 @@ local function FuzzySort(str, func, ...)
--Roughly sort everything by it's distance to the string
local usorted = {}
+ local sorted = {}
for k,v in prs(looparg) do
local dist = func(str,v)
- usorted[dist] = usorted[dist] or {}
+ if usorted[dist] == nil then
+ usorted[dist] = {}
+ tblins(sorted,dist)
+ end
tblins(usorted[dist],v)
end
--Actually sort them into something can can be iterated with ipairs
- local sorted = {}
- for k,v in prs(usorted) do
- tblins(sorted,k)
- end
tblsrt(sorted)
--Then build our output table