Is it possible to do this? Please note that I can't do it any other way.
I have a VBScript. The first line is a varialbe set to the name of a function that I want to call. I would like to call the function that has the same name that is stored in the "FuncToCall" variable. How can I call the function: FuncAdd(10, 5) which should return 15?
In C++ I could use a pointer, but I have no clue about VBScript...
'------------------- Dim FuncToCall FuncToCall = "FuncAdd"
' SOME HOW CALL FuncAdd(10, 5) . It should return 15. ' FuncAddResult = FuncToCall(10, 5)
Function FuncAdd (x, y) FuncAdd = x + y End Function
while DiGiTAL.SkReAM's advice to use Execute(Global) (or Eval to mention the third construct of this kind) - that is the interpretation of (string) data as code - will solve your problem, you should be aware of the fact that VBScript's equivalence to C/C++ pointers (delegates in the .NET languages) is