Variables can be a difficult concept. IDK your experience. A structure could simplify and organize things.
See:
https://wiki.gdevelop.io/gdevelop5/all-features/variables/structures-and-arrays/
Variables are very flexible. You can mix and match different things like an array or structures or a structure of structures. The structure can contain other structures or arrays.
Structures and arrays need to be consistent. An array of structures should all have the same children in every structure. For example, each structure could have a weight and quantity child variable. They should all be numerical.
If you had an array of structures then you could have children named, item, quantity and weight.
If you had a structure of structures then the structure name could be the item name with children named weight and quantity.
Its the difference between
Inventory[0].Item=“wood”
Inventory[0].quantity = 10
Inventory[0].weight = 10
And
Inventory.wood.quantity =10
Inventory.wood.weight=100
If the individual weight is fixed then weight could be in a structure and you could just store the quantity. You could then multiple the quantity by the weight from the structure.
The weight structure could be a variable like weights with the children names of the items.
You could then use for each child to add up the weights using weights[Item] where the variable item could be the item like wood or whatever.
I’m not sure what your goal is. The structure could include a structure that included cost or a description or any other detail.
If you’re new to the concept of structures then maybe it would be easier to create some test projects that use structures. Just to get a better understanding in a simplier environment.
I can clarify anything I posted. I went on a bit and it might not all be applicable.