How would I check if this is in a dictionary?

I want to check if an object’s Name is found in a dictionary.
For example,

local dictionary = {
  ['ABC'] = 'bcd'

If an object’s Name is equal to ABC, its Name would be switched to bcd.

for i,v in pairs (dictionary)do
	if v == object.Name then object.Name = v
end end

I think the v is bcd but not ABC, so I can’t check if the object’s Name is ABC and therefore I can’t change it to bcd. How would I check if this is in a dictionary?

The i in your loop is ABC.

You can do

if dictionary[object.Name] ~= nil then


To make sure object.Name is a key in the table

Going off of what @sjr04 said, the i = index = ‘ABC’ and the v = value = ‘bcd’. You actually don’t need a loop to accomplish what you want to do (you essentially want to change .Name based off of a dictionary value). You can use the value of object.Name as a way to search the dictionary. Here’s what I mean:

local dictionary = {
	['ABC'] = 'bcd'

--Checks to see if the object's Name is inside the dictionary.
--In this case it is 'ABC', which has the value of 'bcd'
if dictionary[object.Name] then
	--This will set the Object's name based off of the value stored in the dictionary
	--In this case the value is 'bcd'
	object.Name = dictionary[object.Name]