How do i find a index based on value in tables

i want to get the “name” of an item in my table here:
image

i tried
table.find but that didnt work…

for example lets say i wanna find out what “12858746579” is called, in this case its called “coolestcat” but how would i find that out?

you have to iterate through it, you can make a function that does this

local function findIndex(table, query)
	for index, value in table do
		if value == query then
			return index
		end
	end
end

print(findIndex(Images, 12858746579))

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.