Evaluating a mathematical expression

Is there anything already built into Corona or Lua to evaluate a mathematical expression.

For example, pass in “-2 + 3” and get “1” returned. I don’t need anything complicated like variable substitution or operators other than ±*/.

I have found articles about invoking Lua from within C++ to evaluate an expression so it seems like it might be possible directly within Lua.

I have also seen an article saying it could b achieved by setting up a Lua ‘fallback’ but I am too new to Lua and could not get that method to work. [import]uid: 163144 topic_id: 29412 reply_id: 329412[/import]

well i’m assuming that you will need the answer of the problem in you code/app in some way so what you could do is just make a local variable and set it equal to the problem you what solved so-

local Answer = -2 + 3

and then the variable Answer will be set to the answer of -2 + 3

hope this helps,

-Boxie [import]uid: 113909 topic_id: 29412 reply_id: 118198[/import]

Thanks for your response but the actual calculation will come from the user in string format, not hard-coded into my code. [import]uid: 163144 topic_id: 29412 reply_id: 118202[/import]