From 9209d81d2022146ff53aea42dc66739b97b9138b Mon Sep 17 00:00:00 2001 From: Anthony Zhang Date: Wed, 20 Mar 2013 17:12:48 -0400 Subject: //metasave and //metaload are now superceded by //save and //load's new functionality. worldedit.deserialize now supports every version of the WorldEdit format that has ever existed, and the new worldedit.valueversion uses file characteristics to determine which type of file format a given file uses. The new WorldEdit file format is the same as the one used by MineTest for serializing data, and is capable of storing arbitrary data, as well as leaving fields for future improvements. In other words, this is the last forward-compatibility breaking change that will be made to the file format. --- worldedit/compatibility.lua | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 worldedit/compatibility.lua (limited to 'worldedit/compatibility.lua') 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 -- cgit v1.2.3