Diff

util/json.lua @ 7235:ee1f7e1e548c

util.json: Fix encoding of json.null (bug introduced in bf1f09a5bcf7)
author Matthew Wild <mwild1@gmail.com>
date Fri, 04 Mar 2016 22:27:04 +0000
parent 6785:bf1f09a5bcf7
child 7259:d8300985f2bb
line wrap: on
line diff
--- a/util/json.lua	Fri Mar 04 22:17:38 2016 +0000
+++ b/util/json.lua	Fri Mar 04 22:27:04 2016 +0000
@@ -145,7 +145,9 @@
 
 function simplesave(o, buffer)
 	local t = type(o);
-	if t == "number" then
+	if o == null then
+		t_insert(buffer, "null");
+	elseif t == "number" then
 		t_insert(buffer, tostring(o));
 	elseif t == "string" then
 		stringsave(o, buffer);