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 return
end end
self:open() self:open()
self.root = {}
self:_write() self:_write()
end end

@ -345,8 +345,9 @@ assert(colorspec.from_string"#694269":to_string() == "694269")
-- Persistence -- Persistence
local function test_logfile(reference_strings) 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() logfile:init()
assert(logfile.root.root_preserved)
logfile.root = {a_longer_string = "test"} logfile.root = {a_longer_string = "test"}
logfile:rewrite() logfile:rewrite()
logfile:set_root({a = 1}, {b = 2, c = 3, d = _G.math.huge, e = -_G.math.huge}) logfile:set_root({a = 1}, {b = 2, c = 3, d = _G.math.huge, e = -_G.math.huge})