Page 1 of 1

Evaluate a string to run a function?

Posted: 09 Aug 2014 18:06
by RufusWhite
Hi,

is there a way of running a script from a string - so for example at right now, I'm just using if():

Code: Select all

if (x) { pgm1(); }
else if (y) { pgm2(); }
else if (z) { pgm3(); }
whereas I'd prefer to do:

Code: Select all

evaluate('pgm' + currentPgm + '();');
is there a way of doing this?

Many thanks!
Rufus