So im trying to detect a mathematical symbol for a project, but I cannot seem to get it to work. Code:

for i,v in pairs(array) do

warn(v)

if v == "+" then

v = "add"

end

if v == "-" then

v = "sub"

end

if v == "*" then

v = "time"

end

if v == "/" then

v = "div"

end

if v == "^" then

v = "sq"

end

end

2 comments

0

there is no specific way to easily get only arithmetic operators, as there is no specific string pattern that only encompasses arithmetic operators. There is, however a string pattern that encompasses all special characters

0

Alternatively, you can use a dictionary of corresponding values