Comparison

util/serialization.lua @ 2222:81b4e738e4d3 0.6.1

util.serialization: Correctly serialize tables with 'false' as a key, fixes an issue with rosters not saving (thanks mathias, Tobias)
author Matthew Wild <mwild1@gmail.com>
date Wed, 25 Nov 2009 23:45:45 +0000
parent 2149:603134825bdb
child 2923:b7049746bd29
comparison
equal deleted inserted replaced
2219:9e1c6b6a2ee4 2222:81b4e738e4d3
33 if type(o) == "number" then 33 if type(o) == "number" then
34 func(t, tostring(o)); 34 func(t, tostring(o));
35 elseif type(o) == "string" then 35 elseif type(o) == "string" then
36 func(t, (("%q"):format(o):gsub("\\\n", "\\n"))); 36 func(t, (("%q"):format(o):gsub("\\\n", "\\n")));
37 elseif type(o) == "table" then 37 elseif type(o) == "table" then
38 if next(o) then 38 if next(o) ~= nil then
39 func(t, "{\n"); 39 func(t, "{\n");
40 for k,v in pairs(o) do 40 for k,v in pairs(o) do
41 func(t, indent(ind)); 41 func(t, indent(ind));
42 func(t, "["); 42 func(t, "[");
43 func(t, basicSerialize(k)); 43 func(t, basicSerialize(k));