CyclopsMC / IntegratedCrafting

Craft stuff in Integrated Dynamics networks
MIT License
7 stars 6 forks source link

New operator: return <any> if <boolean> #78

Closed Corfiot closed 2 years ago

Corfiot commented 2 years ago

Issue type:


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.

rubensworks commented 2 years ago

Thanks for the suggestion!

rubensworks commented 2 years ago

You can use the choice operator for this.

Corfiot commented 2 years ago

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