I'm making a gui calculator, how to convert string to operators?

Since my gui calculator only accepts string input from players, can you show how I can do that?
For example if the input was “2+5^2”, how would I make the parser calculate that?

You could probably just modify the parser to use the ^ symbol for exponents instead of bitwise xor. I’ll look into it tomorrow.

1 Like

Actually I found it.

Line 1257 of the module says this:

v = bit.bxor( coerce(v1, "number"), coerce(v2, "number") )

Change it to this:

v = coerce(v1, "number") ^ coerce(v2, "number")

and it should work.

1 Like