#dictionary help

3 messages · Page 1 of 1 (latest)

calm monolith
#

How would I completely remove an item/string from a dictionary absolutely? Like its not set to 0 but actually not there anymore ?

humble rapids
#

With Arrays (Tables that use integers for entries), you can do table.remove()
But since that doesn't work on Dictionaries, the best you can do is setting the entry to nil.
THANKFULLY, all infinite possible dictionary entries by default are nil, so it will remove itself automatically if nil since it's a part of infinite values.
Here's the proof:

#
local Dictionary = {
    Value1 = "HI";
    Value2 = "BYE"
}

print(Dictionary)

Dictionary.Value2 = nil
print("Setting Value2 to nil")

print(Dictionary)