Removing data from tables

so say i had a table

table1 = {“oranges”, “apples”, “bananas”, “dogs”, “cats”, “rabbits”}

And i wanted to make a table of stuff to remove from that table

table2 = {“dogs”, “cats”, “rabbits”}

how would I make it so that all the stuff from table2 is taken from table1 so i end up with

finaltable = {“oranges”, “apples”, “bananas”}

thanks
jason


local x = { "a", "pie", "delta", "money" }
table.remove( x, 2 )
Msg( x ) -- { "a", "delta", "money" }

gmod wiki is teh best, you can find everything for tables at http://wiki.garrysmod.com/?title=Table

the code above will give you everything except the sencond ( note the 2 ) part of the table

[editline]02:54PM[/editline]

table.remove( table, [ ID ] )

[editline]02:54PM[/editline]

**[Table.remove

http://wiki.garrysmod.com/favicon.ico](wiki.garrysmod.com/?title=Table.remove)**

i dont want it to remove the second entry i want it to remove everything thats in table2

[lua]
function table.remove_table_from_table(t1, t2)
for k,v in pairs(t2) do
for k2,v2 in pairs(t1) do
if v == v2 then
table.remove(t1, k2)
break
end
end
end
end
[/lua]

[lua]function table.RemoveN(tab1, tab2)
for _, v in ipairs(tab1) do
for k, w in ipairs(tab2) do
if w == v then
table.remove(tab1, k);
break;
end
end
end
end[/lua]

[editline]02:01PM[/editline]

Holy fuck, ninja’d

omg thanks man u rly helped!