evaluate a string
BlitzMax Forums/BlitzMax Beginners Area/evaluate a string
| ||
Is it possible to evaluate the content of a string. I mean, if you have for example: text:string = "Sin(25)" how can i calcul the result. |
| ||
By writting a math/function evaluator. Bmax is not run like a virtual machine, it is compiled. |
| ||
you may want to take a look at the LUA module |
| ||
Super, the LUA is really good, thank's |
| ||
You could also write a simple formula evaluator. I did one once based on counting the number of open and closed brackets and working through them in a nested manner to preserve the order of precedence. You could easily convert the string "Sin" into a function call to Sin, passing the value. |