mirror of
https://github.com/koreader/koreader.git
synced 2025-08-10 00:52:38 +00:00
add table persistence module
This commit is contained in:
committed by
Frans de Jonge
parent
47b0d4089a
commit
b8f0dc3752
@@ -1160,23 +1160,6 @@ function util.clearTable(t)
|
||||
for i = 0, c do t[i] = nil end
|
||||
end
|
||||
|
||||
--- Dumps a table into a file.
|
||||
--- @table t the table to be dumped
|
||||
--- @string file the file to store the table
|
||||
--- @treturn bool true on success, false otherwise
|
||||
function util.dumpTable(t, file)
|
||||
if not t or not file or file == "" then return end
|
||||
local dump = require("dump")
|
||||
local f = io.open(file, "w")
|
||||
if f then
|
||||
f:write("return "..dump(t))
|
||||
f:close()
|
||||
return true
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
|
||||
--- Encode URL also known as percent-encoding see https://en.wikipedia.org/wiki/Percent-encoding
|
||||
--- @string text the string to encode
|
||||
--- @treturn encode string
|
||||
|
||||
Reference in New Issue
Block a user