mirror of
https://github.com/appgurueu/modlib.git
synced 2024-11-26 09:13:53 +01:00
Fix Lua log file reference handling if only :load() and not :init() is called
This commit is contained in:
parent
2d8c77b7dd
commit
407a2d55ed
@ -44,7 +44,15 @@ function lua_log_file:load()
|
||||
setfenv(read, env)
|
||||
read()
|
||||
env.R = env.R or {{}}
|
||||
self.reference_count = #env.R
|
||||
local reference_count = #env.R
|
||||
for ref in pairs(env.R) do
|
||||
if ref > reference_count then
|
||||
-- Ensure reference count always has the value of the largest reference
|
||||
-- in case of "holes" (nil values) in the reference list
|
||||
reference_count = ref
|
||||
end
|
||||
end
|
||||
self.reference_count = reference_count
|
||||
self.root = env.R[1]
|
||||
set_references(self, {})
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user