Skip to content

Commit

Permalink
fix new console printing
Browse files Browse the repository at this point in the history
  • Loading branch information
Dregu committed Oct 20, 2023
1 parent cb08eb1 commit 975769f
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/game_api/lua_libs/lua_libs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -960,7 +960,9 @@ return { _NAME = n, _COPYRIGHT = c, _DESCRIPTION = d, _VERSION = v, serialize =
function dump(o, d, n)
local n = n or 0
local t = nil
if getmetatable(o) and (not d or n < d) then
if type(o) == "string" or type(o) == "number" then
t = o
elseif getmetatable(o) and (not d or n < d) then
t = {}
if o.pairs then
for k,v in pairs(o) do
Expand All @@ -979,7 +981,7 @@ return { _NAME = n, _COPYRIGHT = c, _DESCRIPTION = d, _VERSION = v, serialize =
return t
end
function dump_string(o, d)
return serpent.line(dump(o, d), {comment=false, indent=" "})
return ((type(o) ~= "boolean" and type(o) ~= "string" and type(o) ~= "number" and type(o) ~= "table") and tostring(o)..": " or "") .. serpent.line(dump(o, d), {comment=false, indent=" "})
end
)##");
}

0 comments on commit 975769f

Please sign in to comment.