Say I had this:
local fruits = {
apple: "Red",
banana: "Yellow"
}
How would you remove a key-value pair from fruits
? Do you just set a key’s value to nil
? Is there a remove function designed for dictionaries?
Say I had this:
local fruits = {
apple: "Red",
banana: "Yellow"
}
How would you remove a key-value pair from fruits
? Do you just set a key’s value to nil
? Is there a remove function designed for dictionaries?
My concern is that those functions are designed for an array/table. I don’t know if it works the same with dictionaries.
That doesn’t work, just do fruits[apple] = nil
. The PiL link you posted mentions this:
The
table.remove
function removes (and returns) an element from a given position in an array
Yep! I was replying to Cyafu, clarifying that these won’t work at all. You said you didn’t know, so I felt it was best to clarify.
Oh, sorry for the confusion. I thought you were talking to me.