Returning a table inside a table by finding a "child"

Here’s my problem,
I don’t know how to get a table inside a table but I want to get it by finding a string Inside
It’s hard to explain.
here is a part of my module

Valentine = {
					items = { 
						{
							name = "Eternal", 
							image = { 1425549223, 1425549531}, 
							type = "Divine", 
						},

I want to get the image table by finding the name
in a simplie way, i want to go back to items and get the image table after getting the name

local item_name = module.sections["Knife Skins"].gifts.Valentine.items[msg[3]]
local images = item_name. <-Parent-> .image
local items = module.sections["Knife Skins"].gifts.Valentine.items
local itemName = items[msg[3]]
local images = items.image

doesnt work, because of the table have multiple things

could you post the whole table maybe that would help and maybe explain what you are exactly trying to fetch. what I can tell so far is that you’re either trying to get a specific ID or are converting a table to an unpack tuple. but I don’t really know what you’re saying lol

didnt know that it was an array

also, looking back, the example code you gave wouldn’t work either?

item_name would be the item, not the name, which implies that image would just be item_name.image???

and why would you want to use an array in the first place? a dictionary sounds more suitable for this kind of purpose where you’re defining each item

furthermore, what you’re asking is impractical, why do you need to go backwards to find a sibling element when you can simply just store the reference itself?

also the order of a table isn’t random when you don’t supply an index (maybe you already knew this) and you can just iterate through them

I wrote something that I think is what you’re looking for.

local foo = {
	[1] = {0, 1},
	[2] = 0
}

for i, v in pairs(foo) do
	if typeof(v) == 'table' then
		table.foreach(v, print) -- will print the numbers in order
	elseif typeof(v) == 'number' then
		print(v) -- will print the number
	end
end

edit: but if you’re looking for that number you just save the i variable when you figure out wether it’s a table or a number

Just iterate through the valentines dictionary then find the items table and find a sub table with the name being what you need

local targetName = "Eternal"

local function GetTableByName(name)
   for index, val in pairs(Valentine) do
      if typeof(val) == "table" then
         for _, tbl in ipairs(val) do
            if tbl.name == name then
               return tbl
            end
         end
      end
   end
end

local tblInfo = GetTableByName(targetName)
print(
   tblInfo.name,
   tblInfo.image,
   tblInfo.type
)

I will just redo my tables from scratch, sorry yall for the time wasted