diff options
Diffstat (limited to 'core/variant/variant.cpp')
-rw-r--r-- | core/variant/variant.cpp | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/core/variant/variant.cpp b/core/variant/variant.cpp index f24ffeb1a9..e3819fa632 100644 --- a/core/variant/variant.cpp +++ b/core/variant/variant.cpp @@ -1835,11 +1835,13 @@ String Variant::stringify(int recursion_count) const { case DICTIONARY: { const Dictionary &d = *reinterpret_cast<const Dictionary *>(_data._mem); if (recursion_count > MAX_RECURSION) { - ERR_PRINT("Max recursion reached"); - return "{...}"; + ERR_PRINT("Maximum dictionary recursion reached!"); + return "{ ... }"; } - String str("{"); + // Add leading and trailing space to Dictionary printing. This distinguishes it + // from array printing on fonts that have similar-looking {} and [] characters. + String str("{ "); List<Variant> keys; d.get_key_list(&keys); @@ -1858,9 +1860,9 @@ String Variant::stringify(int recursion_count) const { if (i > 0) { str += ", "; } - str += pairs[i].key + ":" + pairs[i].value; + str += pairs[i].key + ": " + pairs[i].value; } - str += "}"; + str += " }"; return str; } break; @@ -1894,7 +1896,7 @@ String Variant::stringify(int recursion_count) const { case ARRAY: { Array arr = operator Array(); if (recursion_count > MAX_RECURSION) { - ERR_PRINT("Max recursion reached"); + ERR_PRINT("Maximum array recursion reached!"); return "[...]"; } |