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?
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?
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
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