Comparison

util/datamanager.lua @ 82:cbf387f29d56

Fix for saving tables with non-string keys
author Matthew Wild <mwild1@gmail.com>
date Wed, 08 Oct 2008 22:42:51 +0100
parent 0:3e3171b59028
child 87:059ef1c30844
comparison
equal deleted inserted replaced
81:a1f4f3c5ae25 82:cbf387f29d56
41 elseif type(o) == "string" then 41 elseif type(o) == "string" then
42 f:write(format("%q", o)) 42 f:write(format("%q", o))
43 elseif type(o) == "table" then 43 elseif type(o) == "table" then
44 f:write("{\n") 44 f:write("{\n")
45 for k,v in pairs(o) do 45 for k,v in pairs(o) do
46 f:write(" [", format("%q", k), "] = ") 46 f:write(" [", basicSerialize(k), "] = ")
47 simplesave(f, v) 47 simplesave(f, v)
48 f:write(",\n") 48 f:write(",\n")
49 end 49 end
50 f:write("}\n") 50 f:write("}\n")
51 else 51 else