Página 1 de 1

Run strings

Publicado: 11 Ene 2016 10:00
por mahdi1993
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 ???

Re: Run strings

Publicado: 11 Ene 2016 11:21
por Pabloko
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)")

Re: Run strings

Publicado: 11 Ene 2016 11:27
por mahdi1993
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 !

Re: Run strings

Publicado: 29 Feb 2016 14:15
por Naritaokaza
This knowledge is very useful, really.

Re: Run strings

Publicado: 01 Mar 2016 04:24
por NicolasG
Dialog.Message("penis",  2*3^5-6*4/5);


When you want to do a calculation not use quotes.
:chompy-1414025208:

Re: Run strings

Publicado: 01 Mar 2016 19:04
por abood1987
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

Re: Run strings

Publicado: 14 Nov 2018 14:45
por usamakey
tnks abood

Re: Run strings

Publicado: 14 Nov 2018 18:03
por hdd.utilities
graças

Re: Run strings

Publicado: 07 Dic 2018 14:26
por sendai
great share

Re: Run strings

Publicado: 08 Dic 2018 03:27
por gonpublic2k
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!

Re: Run strings

Publicado: 31 Ene 2019 09:44
por good
AMS Templates

Re: Run strings

Publicado: 09 Abr 2019 23:57
por electrobyte
interesante

Re: Run strings

Publicado: 18 Jul 2020 16:28
por mahdi1993
thanks dear friend

Re: Run strings

Publicado: 23 Nov 2020 18:15
por YHWH
interesante