so basically im tryna make a function that will merge any 2 tables into 1, and i wanted to allow the second table to contain tables that can be broken down into their individual objects, but the problem is that i'm having issues detecting if an item in the table is a table, i tried the :IsA() function, but that produces an error since I'm testing with a table of strings and not a table of tables. Any tips?
heres the code
local module = {}
function mergeTables(table1:SharedTable,table2:SharedTable,BreakTable2:boolean) -- BreakTable2 determines if table2 is broken into objects
for i = 1, #table1 do
if table2[i]:IsA("SharedTable") and BreakTable2 == true then
mergeTables(table1,table2[i])
else
table.insert(table1,table2[i])
end
end
return table1
end
function module.merge(baseTable:SharedTable, addTable:SharedTable, BreakTable:boolean)
local result = baseTable
result = mergeTables(result,addTable,BreakTable)
return result
end
return module