summaryrefslogtreecommitdiff
path: root/worldedit/compatibility.lua
diff options
context:
space:
mode:
Diffstat (limited to 'worldedit/compatibility.lua')
-rw-r--r--worldedit/compatibility.lua17
1 files changed, 17 insertions, 0 deletions
diff --git a/worldedit/compatibility.lua b/worldedit/compatibility.lua
new file mode 100644
index 0000000..3b9c889
--- /dev/null
+++ b/worldedit/compatibility.lua
@@ -0,0 +1,17 @@
+worldedit.allocate_old = worldedit.allocate
+worldedit.deserialize_old = worldedit.deserialize
+worldedit.metasave = function(pos1, pos2, filename)
+ local file, err = io.open(filename, "wb")
+ if err then return 0 end
+ local data, count = worldedit.serialize(pos1, pos2)
+ file:write(data)
+ file:close()
+ return count
+end
+worldedit.metaload = function(originpos, filename)
+ filename = minetest.get_worldpath() .. "/schems/" .. file .. ".wem"
+ local file, err = io.open(filename, "wb")
+ if err then return 0 end
+ local data = file:read("*a")
+ return worldedit.deserialize(originpos, data)
+end \ No newline at end of file