Help with table method

I’m a good scripter, but for some reason I can’t get my head around the basics.

I have a table with 3 items of pizza and 3 items of cola. How do I put the information from this table into a new table, labeling what type of item and its quantity?
Снимок экрана 2024-10-01 в 19.31.12

1 Like

But I’m pretty sure I need a method for i,v in pairs()
But I don’t know what exactly I’m supposed to do

1 Like

Yes, exactly, first get your table and loop through it using for i,v in ipairs() loop and add each item to your new table using the item name as the key and the quantity as the value

for _, item in ipairs(oldTable) do
    NewTable[item.name] = item.quantity
end
2 Likes