Math expression parser to be added to flib?
gabfv opened this issue · 1 comments
gabfv commented
Hi,
I saw another mod (cybersyn combinator) that implemented a way to parse math expression (like in a combinator when setting a signal). However, I wanted a safer version of a math expression parser so I wrote one proof of concept. It's kinda basic but it supports parsing the followings operations: -, +, *, /, parenthesis and negative numbers.
So I wanted to know, would you like to integrate this into flib (I'll make a PR for this later, if you choose this)? Or should I spin off my own factorio mod library?
raiguard commented
The API actually has a function for this: game.evaluate_expression. It's normally only used for infinite technology costs, but it's pretty general-purpose and could be used elsewhere as well!