I’m not sure exactly how to word this but I will certainly try my best.
Lets say we have a Dictionary with my Username and a “Level”,
local dict = {
['wayIxn'] = 100,
}
I will be adding names in which I do not know so heres an example of it whenever I need to remove a value.
local dict = {
['wayIxn'] = 100,
['Telamon'] = 35,
['Roblox'] = 10, -- levels really have nothing to do with this.
}
Okay, I do not know what these values are.
I need to remove a string so I want to remove Roblox from the list. I do not know its place in the dictionary (3) therefore we cannot remove using table.remove(). I know no other way of removing this value.
Thanks! (Sorry, I had absolutely no clue how to word this feel free to give suggestions heh…)
Dictionaries do not have order. Just because you assigned the values in that order, does not mean that’s how they’ll appear in a loop. As Notwal said - setting the value of the key to nil removes it from the table.
You could set values of an array to nil to remove them, too… however this would leave gaps in your array. This is why table.remove exists, solely.