Comparison

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
comparison
equal deleted inserted replaced
7234:161f9f163e37 7235:ee1f7e1e548c
143 end 143 end
144 end 144 end
145 145
146 function simplesave(o, buffer) 146 function simplesave(o, buffer)
147 local t = type(o); 147 local t = type(o);
148 if t == "number" then 148 if o == null then
149 t_insert(buffer, "null");
150 elseif t == "number" then
149 t_insert(buffer, tostring(o)); 151 t_insert(buffer, tostring(o));
150 elseif t == "string" then 152 elseif t == "string" then
151 stringsave(o, buffer); 153 stringsave(o, buffer);
152 elseif t == "table" then 154 elseif t == "table" then
153 local mt = getmetatable(o); 155 local mt = getmetatable(o);