Let's suppose we have the following table with the name of random players:
local SomeRandomPlayers = {"Chris","Milkshake","Something","IDunno","Bob","MeNameJerry"}
What do i do if I want to remove Bob
from the table without having to say:
table.remove(SomeRandomPlayers,5)
In the table there will be tons of players added and removed so I will never know wich place Bob
is..
Any idea how to do that?
Do I have to do some kind of loop
for i,v in pairs (SomeRandomPlayers) do if v.Name then --Still don't know wich place "Bob" is.. end end
Any help is apreciated!
Thanks!
I'm not sure if there is another way but I think this will work
function RemoveFromTable(list,variable) for i,v in pairs(list)do if v == variable then table.remove(list,i) end end end RemoveFromTable(SomeRandomPlayers,"Bob")