I want the user to be able to type 4 +2 * 3 into an input field and for the program to work out the result.
I've tried using int(inputField.Text) but it just takes the first number. I've played around putting the string into a global variable but that's not working either.
Develop games in your browser. Powerful, performant & highly capable.
Two options I can think of off the top of my head:
1. Create a parser to do it. Algorithms to do this are pretty common.
2. Use the ExecJS() expression in the browser object. e.g. ExecJS("4 + 2 * 3") returns 10. This can open you up to security problems, though, so be careful.
Awesome thanks, I'll look into those.