summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--main.lua7
-rw-r--r--nodedb.lua2
2 files changed, 5 insertions, 4 deletions
diff --git a/main.lua b/main.lua
index 460c29d..2a9ff40 100644
--- a/main.lua
+++ b/main.lua
@@ -1,5 +1,5 @@
-- advtrains track map generator
--- Usage:...
+-- Usage: lua main.lua path/to/world
-- Viewport maximum coordinate in all directions
local maxc = 5000
@@ -12,6 +12,7 @@ local wimresy = 3000
-- one pixel is ... nodes
local wimscale = 4
+datapath = (arg[1] or "").."/"
--Constant for maximum connection value/division of the circle
@@ -80,7 +81,7 @@ dofile("nodedb.lua")
-- Load saves
-local file, err = io.open("advtrains", "r")
+local file, err = io.open(datapath.."advtrains", "r")
local tbl = minetest.deserialize(file:read("*a"))
if type(tbl) ~= "table" then
error("not a table")
@@ -96,7 +97,7 @@ file:close()
-- open svg file
-local svgfile = io.open("out.svg", "w")
+local svgfile = io.open(datapath.."out.svg", "w")
svgfile:write([[
<?xml version="1.0" standalone="no" ?>
diff --git a/nodedb.lua b/nodedb.lua
index f79dbbd..570f751 100644
--- a/nodedb.lua
+++ b/nodedb.lua
@@ -57,7 +57,7 @@ local path="advtrains_ndb2"
--nodeids get loaded by advtrains init.lua and passed here
function ndb.load_data(data)
ndb_nodeids = data and data.nodeids or {}
- local file, err = io.open(path, "rb")
+ local file, err = io.open(datapath..path, "rb")
if not file then
print("Couldn't load the node database: ", err or "Unknown Error")
else