Integrated Crafting

Integrated Crafting

31M Downloads

New operator: return <any> if <boolean>

Corfiot opened this issue · 3 comments

commented

Issue type:

  • ➕ Feature request

Short description:

Say you have a crafting writer for an item you only want crafted when there's X on the network and you don't want to dedicate a chest + inventory reader to this cause it's junky.

You could use an operator, possibly called "iif" that takes anything and use it like this

iif(recipe,do-i-need-to-craft-this) ---> recipe
if condition true, return recipe
if condition false, return null

Bonus points for adding a iif_or_default() that you specify the default for, so you could have an empty recipe handy in the above example.

Unless of course I'm missing something here, there's so many operators.

commented

Thanks for the suggestion!

commented

You can use the choice operator for this.

commented

Well, colour me pink and throw me in the river.
Thanks