use the minetest provided table copy function

This commit is contained in:
Tim 2015-08-16 17:24:08 +02:00
parent 45aef81f55
commit d2824c10e7
2 changed files with 1 additions and 14 deletions

View File

@ -400,7 +400,7 @@ for i in ipairs(gates_list) do
minetest.register_node("homedecor:gate_"..gate.."_closed", def) minetest.register_node("homedecor:gate_"..gate.."_closed", def)
-- this is either a terrible idea or a great one -- this is either a terrible idea or a great one
def = homedecor.table_copy(def) def = table.copy(def)
def.groups.not_in_creative_inventory = 1 def.groups.not_in_creative_inventory = 1
def.selection_box.fixed = { 0.4, -0.5, -0.5, 0.5, 0.5, 0.5 } def.selection_box.fixed = { 0.4, -0.5, -0.5, 0.5, 0.5, 0.5 }
def.node_box.fixed = gate_models_open[i] def.node_box.fixed = gate_models_open[i]

View File

@ -19,19 +19,6 @@ homedecor = {
expect_infinite_stacks = minetest.setting_getbool("creative_mode") and not minetest.get_modpath("unified_inventory") expect_infinite_stacks = minetest.setting_getbool("creative_mode") and not minetest.get_modpath("unified_inventory")
} }
--table copy
function homedecor.table_copy(t)
local nt = { };
for k, v in pairs(t) do
if type(v) == "table" then
nt[k] = homedecor.table_copy(v)
else
nt[k] = v
end
end
return nt
end
-- Determine if the item being pointed at is the underside of a node (e.g a ceiling) -- Determine if the item being pointed at is the underside of a node (e.g a ceiling)
function homedecor.find_ceiling(itemstack, placer, pointed_thing) function homedecor.find_ceiling(itemstack, placer, pointed_thing)
-- most of this is copied from the rotate-and-place function in builtin -- most of this is copied from the rotate-and-place function in builtin