Okay so I’m having a bit of trouble trying to figure out how to iterate through two tables to see if each key are the same, and if not insert the key and value from the table that has it, into the table that dosnt
for example: take it I have 2 tables
My Code to iterate through both tables to add the missing data from one table
function GMI:ValBus(business) if table.Count(business) != table.Count(GMI.Businesses) then for gmi_k, gmi_v in pairs (GMI.Businesses) do for k,v in pairs (business) do if gmi_k != k then table.ForceInsert(business, gmi_k, gmi_v) end end end end return business end
The reason on why I cant just go
, is because business is a variable for the player data business. Which im trying to check if the playerdata business has all the same businesses as the server(GMI.Business), and if it dosnt then add those businesses to the playerdata business table, without overriding the playerdata businesses, that the playerdata business already had. Because say if one player was playing with this and there business data was differnt I wouldnt want to override the whole table evertime a new business was add, i would just want to add the ones that the player dosnt have.