summaryrefslogtreecommitdiff
path: root/gitexporter.lua
diff options
context:
space:
mode:
Diffstat (limited to 'gitexporter.lua')
-rw-r--r--gitexporter.lua23
1 files changed, 19 insertions, 4 deletions
diff --git a/gitexporter.lua b/gitexporter.lua
index 013704b..27384e9 100644
--- a/gitexporter.lua
+++ b/gitexporter.lua
@@ -2,11 +2,26 @@
require "lfs"
+
+script_path = arg[0]:match("(.*/)")
minetest = {} -- hack around serializelib
-minetest.get_modpath = function () return "serialize_lib" end
+minetest.get_modpath = function () return script_path.."serialize_lib" end
minetest.log = function() end
minetest.get_current_modname = function() end
-base_path = "envs"
+dofile(script_path.."serialize_lib/init.lua") -- load serialize lib
+
+function usage()
+ print("Usage: gitexporter.lua worldpath outpath")
+end
+
+if #arg < 2 then
+ print("too few arguments!")
+ usage()
+ return
+end
+
+inpath = arg[1]
+base_path = arg[2]
function ensure_dir(path)
if not (lfs.attributes(path, "mode") == "directory") then
@@ -23,9 +38,9 @@ function node_file(env, pos)
return base.."/"..pos..".lua"
end
-dofile("serialize_lib/init.lua")
-tb = serialize_lib.read_table_from_file("advtrains_atlatc.ls")
+
+tb = serialize_lib.read_table_from_file(inpath.."/advtrains_atlatc.ls")
ensure_dir(base_path)