6 mensajes Página 1 de 1
Hi to all
Everybody know how can run a math string ?

for example :

My_String = "2+2";

result = Action(My_String);

--return 4


if it is possible, whit which function ???
Imagen
life is beauty
use this

function lua_dostring(sLua)
    local Return, Error = pcall(function(s)
        return loadstring(s)();
    end, sLua);
    return Return, Error;
end
 
Parsed in 0.002 seconds, using GeSHi 1.0.8.9


lua_dostring("k='ayyy lmao'; Dialog.Message(k,k)")
Parsed in 0.002 seconds, using GeSHi 1.0.8.9
ImagenImagenImagenImagen
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 !
Imagen
life is beauty
This knowledge is very useful, really.
Dialog.Message("penis",  2*3^5-6*4/5);
Parsed in 0.002 seconds, using GeSHi 1.0.8.9


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:
شما می توانید از کد زیر استفاده
Contenido Oculto: ON
	<br />Usted necesita responder en este tema para ver el contenido oculto.
Imagen
6 mensajes Página 1 de 1

¿Quién está conectado?

Usuarios navegando por este Foro: No hay usuarios registrados visitando el Foro y 2 invitados