diff options
author | Adam Harrison <adamdharrison@gmail.com> | 2023-10-10 11:31:59 -0400 |
---|---|---|
committer | Adam Harrison <adamdharrison@gmail.com> | 2023-10-10 11:31:59 -0400 |
commit | 87823238841b47df4c91e5c8faad03806bcc5cc6 (patch) | |
tree | 076e18298652b57898dbd69ffecddb241cf479b7 /src | |
parent | 1a54a855f9720cad10a4c47f3f65ad92d239373a (diff) | |
download | lite-xl-plugin-manager-87823238841b47df4c91e5c8faad03806bcc5cc6.tar.gz lite-xl-plugin-manager-87823238841b47df4c91e5c8faad03806bcc5cc6.zip |
Added a close for write.
Diffstat (limited to 'src')
-rw-r--r-- | src/lpm.lua | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/lpm.lua b/src/lpm.lua index f755a33..39f7529 100644 --- a/src/lpm.lua +++ b/src/lpm.lua @@ -370,7 +370,7 @@ function common.first(l, p) for i, v in ipairs(l) do if (type(p) == 'function' a function common.slice(t, i, l) local n = {} for j = i, l ~= nil and (i - l) or #t do table.insert(n, t[j]) end return n end function common.join(j, l) local s = "" for i, v in ipairs(l) do if i > 1 then s = s .. j .. v else s = v end end return s end 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.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() f:close() 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) |