Faire une opération mathématique sur une “variable de scène”

Hi, as mentioned here, I started looking into being able to perform calculations directly in scenes. I’m doing this on the « condition » and « control a device » blocks — here’s what it looks like so far

Now I need your help. Quick explanation: once the variables are replaced by values during the execution of the scene, we use the mathjs library to perform the calculation. The problem is that the evaluate() method could allow injecting unwanted JS code into Gladys, so we must restrict this method to the mathematical functions that we really want to use in Gladys. By default, we’ll have at least the standard operators +, -, *, /. What other mathematical functions would you like to use (or already use with the mathjs API)?

A list is available here math.js | an extensive math library for JavaScript and Node.js

3 Likes