From 5095a9f48b26cdadefc7d3e9de2b2a53bd0629e5 Mon Sep 17 00:00:00 2001 From: Mattes D Date: Sun, 10 Jul 2016 08:16:44 +0200 Subject: Fixed Lua Json serializing a bool. Fixes #3257. --- Server/Plugins/Debuggers/Debuggers.lua | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'Server') diff --git a/Server/Plugins/Debuggers/Debuggers.lua b/Server/Plugins/Debuggers/Debuggers.lua index 02510c866..da375cdff 100644 --- a/Server/Plugins/Debuggers/Debuggers.lua +++ b/Server/Plugins/Debuggers/Debuggers.lua @@ -2026,22 +2026,24 @@ end function HandleConsoleTestJson(a_Split, a_EntireCmd) LOG("Testing Json parsing...") - local t1 = cJson:Parse([[{"a": 1, "b": "2", "c": [3, "4", 5] }]]) + local t1 = cJson:Parse([[{"a": 1, "b": "2", "c": [3, "4", 5], "d": true }]]) assert(t1.a == 1) assert(t1.b == "2") assert(t1.c[1] == 3) assert(t1.c[2] == "4") assert(t1.c[3] == 5) - + assert(t1.d == true) + LOG("Json parsing example 1 successful") + local t2, msg = cJson:Parse([[{"some": invalid, json}]]) assert(t2 == nil) assert(type(msg) == "string") - LOG("Error message returned: " .. msg) + LOG("Json parsing an invalid string: Error message returned: " .. msg) LOG("Json parsing test succeeded") LOG("Testing Json serializing...") - local s1 = cJson:Serialize({a = 1, b = "2", c = {3, "4", 5}}, {indentation = " "}) + local s1 = cJson:Serialize({a = 1, b = "2", c = {3, "4", 5}, d = true}, {indentation = " "}) LOG("Serialization result: " .. (s1 or "")) LOG("Json serializing test succeeded") -- cgit v1.2.3