Calculator using strings

You can look into the module and see how some of the functions are made. I know they made something that does percent and power, it’s just in a more complicated way. You could give Birdelther a PM and ask about the module and it’s functions to remove the hassle. If you don’t want to though, I can check inside of the module myself and see if theres a power or a percentage. You can probably do something like pow for getting powers.

Like, within your script you can have a button named pow but the text saying ^. Then making another elseif button.Name == "pow" then, something like this:

elseif button.Name == "pow" then

TextBox.Text ..= "pow("
end

--[[ you can try to find a way for putting the end parenthesis inside of the function. 
like if the button has been pressed once and it just says ^, it will put pow( in there. 
when it gets clicked again and it's named "end power" or a bool to express that it's active, 
then it'll change the function from adding "pow(" to ")" to finish the expression.]]

I was thinking of this example when looking through the post again, I'm making a gui calculator, how to convert string to operators? - #16 by blokav

He did “asin(1)*2” as a string, so that would mean if we just did something like "pow(10, 4)"it in like that it’d work as intended.

1 Like