Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed regression with merge_tables, fixes #56 #57

Merged
merged 1 commit into from
Jan 17, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 12 additions & 5 deletions init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand Down
Loading