aboutsummaryrefslogtreecommitdiff
path: root/src/lpm.lua
diff options
context:
space:
mode:
authorAdam Harrison <adamdharrison@gmail.com>2023-01-09 20:07:40 -0500
committerAdam Harrison <adamdharrison@gmail.com>2023-01-09 20:07:40 -0500
commit5340a11530316bd70e5314b53961ff7b1796d68b (patch)
tree3c0f755de464a7db70000a24607d8a1496ddd9ed /src/lpm.lua
parent3e5d5b0827058f2eeddfb166d8128fc086a87e28 (diff)
downloadlite-xl-plugin-manager-5340a11530316bd70e5314b53961ff7b1796d68b.tar.gz
lite-xl-plugin-manager-5340a11530316bd70e5314b53961ff7b1796d68b.zip
Fixed some minor bugs.
Diffstat (limited to 'src/lpm.lua')
-rw-r--r--src/lpm.lua3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/lpm.lua b/src/lpm.lua
index e4c47e0..ba81ce0 100644
--- a/src/lpm.lua
+++ b/src/lpm.lua
@@ -370,6 +370,7 @@ function common.join(j, l) local s = "" for i, v in ipairs(l) do if i > 1 then s
function common.sort(t, f) table.sort(t, f) return t end
function common.write(path, contents) local f, err = io.open(path, "wb") if not f then error("can't write to " .. path .. ": " .. err) end f:write(contents) f:flush() end
function common.read(path) local f, err = io.open(path, "rb") if not f then error("can't read from " .. path .. ": " .. err) end return f:read("*all") end
+function common.uniq(l) local t = {} local k = {} for i,v in ipairs(l) do if not k[v] then table.insert(t, v) k[v] = true end end return t end
function common.split(splitter, str)
local o = 1
local res = {}
@@ -1143,7 +1144,7 @@ function Bottle:get_plugin(id, version, filter)
end
end
end
- return table.unpack(common.sort(candidates, function (a,b) return a.version < b.version end))
+ return table.unpack(common.sort(common.uniq(candidates), function (a,b) return a.version < b.version end))
end