lua_log_file:init(): preserve root

This commit is contained in:
Lars Mueller 2021-09-20 21:33:06 +02:00
parent 259f28c886
commit fe9a55505b
2 changed files with 2 additions and 2 deletions

@ -68,7 +68,6 @@ function init(self)
return
end
self:open()
self.root = {}
self:_write()
end

@ -345,8 +345,9 @@ assert(colorspec.from_string"#694269":to_string() == "694269")
-- Persistence
local function test_logfile(reference_strings)
local logfile = persistence.lua_log_file.new(mod.get_resource"logfile.test.lua", {}, reference_strings)
local logfile = persistence.lua_log_file.new(mod.get_resource"logfile.test.lua", {root_preserved = true}, reference_strings)
logfile:init()
assert(logfile.root.root_preserved)
logfile.root = {a_longer_string = "test"}
logfile:rewrite()
logfile:set_root({a = 1}, {b = 2, c = 3, d = _G.math.huge, e = -_G.math.huge})