How to add an extra value to a dictionary?

So you have a basic dictionary,

local dictionary = {
["One"] = 1;
["Two"] = 2
}

Im currently having a problem of needing to add extra values to that, how would I go about doing that?

For example, I’d need to add [“Three”] = 3. I’ve tried using table.insert in about every configuration I can think of and stuff can not figure out how… Any help is appreciated!

dictionary["Three"] = 3

or

dictionary.Three = 3 -- but this only works if the key is a string
2 Likes

Alright, I appreciate it!

Going on and assuming that the first one will work for variables… Im having a loop go through a table of values and Im saving the name of those to the value of them. That would be able to take something like this correct?

dictionary[Value.Name] = Value.Value

2 Likes