From c9e25aca43d8a0106dc733174cdad704a22dbc0f Mon Sep 17 00:00:00 2001 From: James Clarke Date: Wed, 17 Jan 2024 14:31:39 +0000 Subject: [PATCH] Fixed regression with merge_tables, fixes #56 (#57) --- init.lua | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/init.lua b/init.lua index fc47c13..572bfb4 100644 --- a/init.lua +++ b/init.lua @@ -107,11 +107,18 @@ local function add_ore(modname, description, mineral_name, oredef, extra_node_de local lump_item = item_base .. "_lump" local function merge_tables(t1, t2) - if t2 then - for k,v in pairs(t2) do t1[k] = v end - end - return t1 - end + for k, v in pairs(t2) do + if type(v) == "table" and type(t1[k]) == "table" then + -- If both t1[k] and v are tables, merge them recursively + merge_tables(t1[k], v) + else + -- Otherwise, simply set the value + t1[k] = v + end + end + return t1 + end + if oredef.makes.ore then local node_def_tbl = {