✓ Accepted answer
The table.remove function only removes values from a list. It will not search through the table looking for the value to match the second argument. It looks for the key, which is suppose to be a number.
Example:
local list = {
"pie",
"ice cream",
"candy",
}
table.remove(list, 2)
If you want to make it so you remove a value from a table based on it's value, you can write a separate function that compares every value in the table to an argument you give it.
Like this:
local list = {
"pie",
"ice cream",
"candy",
}
local function remove_value(Table, Value)
for i,v in pairs (Table) do
if v==Value then
table.remove(Table,i)
end
end
end
remove_value(list, "pie")
print(unpack(list))
7 comments
So how will I remove a certain, randomized player?
wrong. you can remove variables too
I updated the answer. Try using that function.
No dav, you cannot remove a value from a dictionary using table.remove() alone.
Thank you so much!
values you cant, variable you can
I don't think we're on the same page here. Could you give an example of what you mean?