From 975769f3a3f9f40573423121d5cabd2b33b9d831 Mon Sep 17 00:00:00 2001 From: Dregu <dregu@dreg.us> Date: Fri, 20 Oct 2023 18:54:09 +0300 Subject: [PATCH] fix new console printing --- src/game_api/lua_libs/lua_libs.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/game_api/lua_libs/lua_libs.cpp b/src/game_api/lua_libs/lua_libs.cpp index 37fd74d86..1610584b8 100644 --- a/src/game_api/lua_libs/lua_libs.cpp +++ b/src/game_api/lua_libs/lua_libs.cpp @@ -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 @@ -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 )##"); }