Run strings

Aquí podrás hablar de cualquier tema que no tenga un sección específica.
Hi to all
Everybody know how can run a math string ?

for example :

Código: Seleccionar todo

My_String = "2+2";

result = Action(My_String);

--return 4
if it is possible, whit which function ???
use this

function lua_dostring(sLua)
    local Return, Error = pcall(function(s) 
        return loadstring(s)();
    end, sLua);
    return Return, Error;
end


lua_dostring("k='ayyy lmao'; Dialog.Message(k,k)")
Thanks pabloco. it is good.
I was have the code that you put to this topic .
By my request mean specially run Math string such :

x = "2*3^5-6*4/5";

H want to run this code and calculate value and return it !
This knowledge is very useful, really.
Dialog.Message("penis",  2*3^5-6*4/5);


When you want to do a calculation not use quotes.
:chompy-1414025208:
mahdi1993 escribió:Thanks pabloco. it is good.
I was have the code that you put to this topic .
By my request mean specially run Math string such :

x = "2*3^5-6*4/5";

H want to run this code and calculate value and return it !
Welcome mahdi1993 :friends:
You can use the following code:
شما می توانید از کد زیر استفاده
HIDE: ON
Hidebb Message Hidden Description
tnks abood
graças
great share
abood1987 escribió:
01 Mar 2016 19:04
mahdi1993 escribió:Thanks pabloco. it is good.
I was have the code that you put to this topic .
By my request mean specially run Math string such :

x = "2*3^5-6*4/5";

H want to run this code and calculate value and return it !
Welcome mahdi1993 :friends:
You can use the following code:
شما می توانید از کد زیر استفاده
HIDE: ON
Hidebb Message Hidden Description
Great!
AMS Templates
interesante
thanks dear friend
interesante