I’ve come across a potential bug or unexpected behavior of .consumableList
.
For example, we have the following lists:
animal
pig
cow
chicken
zebra
crayfish
jellyfish
worm
output
[x = animal.selectMany(5).consumableList, x.joinItems(", ")]
For example, x
is a consumable list with 5 items like so: cow, cow, pig, chicken, zebra
. The output will then output cow, cow, pig, chicken, zebra
.
Then, to select the items from the consumable list, we can use x.selectOne
.
Outputting it:
output2
[x.selectOne] [x.selectOne] [x.selectOne] [x.selectOne] [x.selectOne]
The expected output should be any combinations of ‘cow, cow, pig, chicken, and zebra’ e.g. cow pig cow zebra chicken
.
However, it throws an error Looks like your consumableList ran out of items. This is the list in question: cow, cow, pig, chicken, zebra
, and outputs an undefined
.
I believe it is because consumable list takes ‘unique’ items. In which, the items in the list have only ‘4’ unique items (cow, chicken, pig, zebra), but it has 5 items (cow, cow, chicken, pig, zebra).
I think the correct behavior of a ‘consumable list’ is to be able to deduct an item from a list and prevent it from being selected again (consuming it), instead of creating a ‘unique list’.
Here is an example generator with the said problem.