diff options
author | Adam Harrison <adamdharrison@gmail.com> | 2023-01-09 20:07:40 -0500 |
---|---|---|
committer | Adam Harrison <adamdharrison@gmail.com> | 2023-01-09 20:07:40 -0500 |
commit | 5340a11530316bd70e5314b53961ff7b1796d68b (patch) | |
tree | 3c0f755de464a7db70000a24607d8a1496ddd9ed /src | |
parent | 3e5d5b0827058f2eeddfb166d8128fc086a87e28 (diff) | |
download | lite-xl-plugin-manager-5340a11530316bd70e5314b53961ff7b1796d68b.tar.gz lite-xl-plugin-manager-5340a11530316bd70e5314b53961ff7b1796d68b.zip |
Fixed some minor bugs.
Diffstat (limited to 'src')
-rw-r--r-- | src/lpm.c | 2 | ||||
-rw-r--r-- | src/lpm.lua | 3 |
2 files changed, 3 insertions, 2 deletions
@@ -999,7 +999,7 @@ static const luaL_Reg system_lib[] = { #endif #endif #ifndef LITE_ARCH_TUPLE - #define LITE_ARCH_TUPLE ARCH_PROCESSOR "-" ARCH_PLATFORM + #define LITE_ARCH_TUPLE (ARCH_PROCESSOR "-" ARCH_PLATFORM) #endif 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 |