|
|
@ -21,6 +21,9 @@ function encode_file(data, path, ...)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
local contents = encode(data, ...)
|
|
|
|
local contents = encode(data, ...)
|
|
|
|
local f = io.open(path, 'w')
|
|
|
|
local f = io.open(path, 'w')
|
|
|
|
|
|
|
|
if not f then
|
|
|
|
|
|
|
|
error('Could not write to ' .. tostring(path))
|
|
|
|
|
|
|
|
end
|
|
|
|
f:write(contents)
|
|
|
|
f:write(contents)
|
|
|
|
f:close()
|
|
|
|
f:close()
|
|
|
|
end
|
|
|
|
end
|
|
|
@ -32,7 +35,7 @@ end
|
|
|
|
function decode_file(path, ...)
|
|
|
|
function decode_file(path, ...)
|
|
|
|
local f = io.open(path)
|
|
|
|
local f = io.open(path)
|
|
|
|
if not f then
|
|
|
|
if not f then
|
|
|
|
error('Could not open ' .. path)
|
|
|
|
error('Could not read from ' .. tostring(path))
|
|
|
|
end
|
|
|
|
end
|
|
|
|
local contents = f:read('*all')
|
|
|
|
local contents = f:read('*all')
|
|
|
|
f:close()
|
|
|
|
f:close()
|
|
|
|