Use json for footpath node graph save format

master
Ciaran Gultnieks 2014-04-30 22:02:17 +01:00
parent 5b332782d8
commit d0f4bb185c
1 changed files with 4 additions and 4 deletions

View File

@ -21,18 +21,18 @@ people.footpath_save = function()
lnodes[n] = {name=n, pos=nn.pos, neighbours=nei}
end
local f = io.open(minetest.get_worldpath().."/people_footpaths", "w+")
local f = io.open(minetest.get_worldpath().."/people_footpaths.json", "w+")
if f then
f:write(minetest.serialize(lnodes))
f:write(minetest.write_json(lnodes))
f:close()
end
end
--- Load the footpath network status.
people.footpath_load = function()
local f = io.open(minetest.get_worldpath().."/people_footpaths", "r")
local f = io.open(minetest.get_worldpath().."/people_footpaths.json", "r")
if f then
pathnodes = minetest.deserialize(f:read("*all"))
pathnodes = minetest.parse_json(f:read("*all"))
f:close()
-- Now we need to undo the dereferencing we did when we saved it...