summaryrefslogtreecommitdiff
path: root/init.lua
diff options
context:
space:
mode:
authorAnthony Zhang <azhang9@gmail.com>2012-07-19 22:54:26 -0400
committerAnthony Zhang <azhang9@gmail.com>2012-07-19 22:54:26 -0400
commit2ecdd6cb1dd05b5627cbee32b357cfc15594809b (patch)
tree66e10fd639914e195ea3675b3faaa1bb6ebede8a /init.lua
parent2c2d7fdec17dedb5ba85e9f607e52b677486526f (diff)
Re-add support for the old WorldEdit save format on a load-only basis. Implemented as worldedit.deserialize_old(), and documented in README.md. //load will now transparently detect these files and load them correctly.
Diffstat (limited to 'init.lua')
-rw-r--r--init.lua10
1 files changed, 6 insertions, 4 deletions
diff --git a/init.lua b/init.lua
index 9c72ac1..64e14b5 100644
--- a/init.lua
+++ b/init.lua
@@ -1,8 +1,5 @@
minetest.register_privilege("worldedit", "Can use WorldEdit commands")
---wip: check to make sure player positions are set before doing editing
---wip; fix meseconedit to export to new WorldEdit format
-
worldedit = {}
worldedit.set_pos = {}
@@ -312,7 +309,12 @@ minetest.register_chatcommand("/load", {
local value = file:read("*a")
file:close()
- local count = worldedit.deserialize(pos1, value)
+ local count
+ if value:find("{") then --old WorldEdit format
+ count = worldedit.deserialize_old(pos1, value)
+ else --new WorldEdit format
+ count = worldedit.deserialize(pos1, value)
+ end
minetest.chat_send_player(name, count .. " nodes loaded")
end,