diff options
Diffstat (limited to 'main.lua')
-rw-r--r-- | main.lua | 27 |
1 files changed, 15 insertions, 12 deletions
@@ -85,7 +85,7 @@ function atdump(t, intend) end dofile("vector.lua") -dofile("serialize.lua") +local serialize = dofile("serialize.lua") dofile("helpers.lua") dofile("tracks.lua") dofile("track_defs.lua") @@ -128,22 +128,25 @@ end datapath, mappath, no_trains, worldimage = parse_args(arg) -- Load saves -local file, err = io.open(datapath.."advtrains_trains", "r") -local tbl = minetest.deserialize(file:read("*a")) +local tbl = serialize.read_from_file(datapath.."advtrains_core.ls") +--local file, err = io.open(datapath.."advtrains_trains", "r") +--local tbl = minetest.deserialize(file:read("*a")) if type(tbl) ~= "table" then error("Trains file: not a table") end -advtrains.trains = tbl -file:close() +advtrains.trains = tbl.trains +--file:close() --ndb contains the defs, while ndb2 is the actual contents -file, err = io.open(datapath.."advtrains_ndb", "r") -tbl = minetest.deserialize(file:read("*a")) -if type(tbl) ~= "table" then - error("Node database file: not a table") -end -advtrains.ndb.load_data(tbl) -file:close() +dofile("nodedb.lua") +local file, err = io.open(datapath.."advtrains_ndb4.ls", "r") +--tbl = minetest.deserialize(file:read("*a")) +--if type(tbl) ~= "table" then + --error("Node database file: not a table") +--end +--advtrains.ndb.load_data(tbl) +advtrains.ndb.load_callback(file) +--file:close() -- open svg file |