mirror of
https://github.com/appgurueu/modlib.git
synced 2024-11-29 10:43:43 +01:00
Lua log file: Fix short notations
This commit is contained in:
parent
29ed334369
commit
8a14f04734
@ -80,13 +80,12 @@ function lua_log_file:_dump(value, is_key)
|
|||||||
if _type == "number" then
|
if _type == "number" then
|
||||||
return ("%.17g"):format(value)
|
return ("%.17g"):format(value)
|
||||||
end
|
end
|
||||||
if self.references[value] then
|
local reference = self.references[value]
|
||||||
return "R[" .. self.references[value] .. "]"
|
if reference then
|
||||||
|
return "R[" .. reference .."]"
|
||||||
end
|
end
|
||||||
self.reference_count = self.reference_count + 1
|
reference = self.reference_count + 1
|
||||||
local reference = self.reference_count
|
|
||||||
local key = "R[" .. reference .."]"
|
local key = "R[" .. reference .."]"
|
||||||
self.references[value] = reference
|
|
||||||
local formatted
|
local formatted
|
||||||
if _type == "string" then
|
if _type == "string" then
|
||||||
if is_key and value:len() <= key:len() and value:match"[%a_][%a%d_]*" then
|
if is_key and value:len() <= key:len() and value:match"[%a_][%a%d_]*" then
|
||||||
@ -114,6 +113,8 @@ function lua_log_file:_dump(value, is_key)
|
|||||||
else
|
else
|
||||||
error("unsupported type: " .. _type)
|
error("unsupported type: " .. _type)
|
||||||
end
|
end
|
||||||
|
self.reference_count = reference
|
||||||
|
self.references[value] = reference
|
||||||
self:log(key .. "=" .. formatted)
|
self:log(key .. "=" .. formatted)
|
||||||
return key
|
return key
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user