So what I mean is,
local dictionary = { ["Thing1"] = {"yuh"}, ["Thing2"] = {"Harambe"} ["Thing3"] = {"Trump cheeto"} }
suppose I have that, what if i wanted to add another "Thing3" to the dictionary, resulting like this:
local dictionary = { ["Thing1"] = {"yuh"}, ["Thing2"] = {"Harambe"} ["Thing3"] = {"Trump cheeto"} ["Thing3"] = {"Trump the orang"} }
Is it possible to do this? Is there a way around this?
No, you can't add two of the same key to a table. You could however make its value a table with the elements you want. Here's an example of that:
local dictionary = { ["Thing1"] = "yuh", ["Thing2"] = "Harambe" ["Thing3"] = {"Trump cheeto", "Trump the orang"} }
Duplicate keys aren't possible. Lua will only use one of those key-value pairs. It wouldn't make sense for duplicates to be possible as there could be ambiguities.
Even if you try something like this:
local t = {a = 1} t.a = 2
a
field is overwritten, it now contains 2
.
If you want, you can just add on to the {"Trump cheeto"}
table.
table.insert(dictionary.Thing3, "Trump the orang")