How to merge two dictionaries?

I need to merge two dictionaries to 1 dictionary

Eg:

local d1 = {
"Name" = {
Example1 = "hi",
Example2 = function()
print("hi again")
end
}
}

local d2 = {
"Name2" = {
Example1 = "hi",
Example2 = function()
print("hi again")
end
}
}

How to merge this two dictionaries to become 1?

1 Like

you might be able to do something like this:

function something(t1, t2) -- two arguments, which are the two tables
	local newt = {} -- make a new table
	for i,v in t1 do -- iterates through table
		newt[i] = v -- adds to table using index
	end
	for i,v in t2 do -- same exact thing with this
		newt[i] = v
	end
	
	return newt -- returns the table
end

local mixedTable = something(d1, d2) -- variable as mixed table

This is very Basic tho, you would need to do more than this, if you want to merge the Descendants of the Tables.

2 Likes

this guy seemed to do it you can try this