Use json for footpath node graph save format
parent
5b332782d8
commit
d0f4bb185c
|
@ -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...
|
||||
|
|
Loading…
Reference in New Issue