Removing entries from a table using another table?

Can anyone give me a tip on how do do this?

Here’s an example:




 Table1 = { Prop1 , Prop2 , Prop3 , Prop4}
 Table2 = {Prop1 , Prop2 , Prop4}



How would I use Table2 to remove entries from Table1? Is that even possible?

Here’s how I’d do it:

[lua]function GetKeyFromValue(t,v)
for k,value in pairs(t) do
if value == v then return k end
end
return false
end

function RemoveTableFromTable(original,remover)
for _,v in ipairs(remover) do
if table.HasValue(original,v) then table.Remove(GetKeyFromValue(original,v)) end
end
end[/lua]

Depends on what you mean.

[lua]
Table1 = { Prop1 , Prop2 , Prop3 , Prop4}
Table2 = {Prop1 , Prop2 , Prop4}

for k,v in pairs( Table2 ) do

for a,b in pairs( Table1 ) do

	if v == b then Table1[a] = nil end

end

end
[/lua]

This removes any entries that are the same on both table1 and table2.

Thanks for you help guys , that’s exactly what I was talking about.