So I want to declare something like this:
The idea is that the [int] is an index (for sorting), so it is unique.
There will only be one entry per item, so the [item] field is unique too.
The float is a quantity that I will be sorting by.
Assume there are a bunch of entries in "stuff" already where the float is 0. Now I want to iterate over each item in "stuff" and set the float based on which item it is. Like:
This would work (I think) but for the [int] index. (note that later in the code I'd do something like "sort stuff by value"). So what's the right way to accomplish this?
Code:
float [int][item]stuff;
There will only be one entry per item, so the [item] field is unique too.
The float is a quantity that I will be sorting by.
Assume there are a bunch of entries in "stuff" already where the float is 0. Now I want to iterate over each item in "stuff" and set the float based on which item it is. Like:
Code:
foreach x in stuff
stuff[x] = somefunction(x);
Last edited: