summaryrefslogtreecommitdiff
path: root/worldedit/serialization.lua
diff options
context:
space:
mode:
Diffstat (limited to 'worldedit/serialization.lua')
-rw-r--r--worldedit/serialization.lua20
1 files changed, 14 insertions, 6 deletions
diff --git a/worldedit/serialization.lua b/worldedit/serialization.lua
index 8e49231..cb65240 100644
--- a/worldedit/serialization.lua
+++ b/worldedit/serialization.lua
@@ -200,16 +200,24 @@ worldedit.metasave = function(pos1, pos2, file) --wip: simply work with strings
local node = env:get_node(pos)
if node.name ~= "air" and node.name ~= "ignore" then
count = count + 1
- local row = {
+ local meta = env:get_meta(pos):to_table()
+
+ --convert metadata itemstacks to itemstrings
+ for i, v in pairs(meta.inventory) do
+ for index, items in ipairs(v) do
+ v[index] = items:to_string()
+ end
+ end
+
+ table.insert(rows, {
x = pos.x-pos1.x,
y = pos.y-pos1.y,
z = pos.z-pos1.z,
name = node.name,
param1 = node.param1,
param2 = node.param2,
- meta = env:get_meta(pos):to_table(),
- }
- table.insert(rows, row)
+ meta = meta,
+ })
end
pos.z = pos.z + 1
end
@@ -217,8 +225,8 @@ worldedit.metasave = function(pos1, pos2, file) --wip: simply work with strings
end
pos.x = pos.x + 1
end
- local err = table.save(rows,filename)
- if err then return _,err end
+ local err = table.save(rows, filename)
+ if err then return _, err end
return count
end