Delphi Web Script: How to call Script function from Delphi code in execution context?

Imaging this script code:

procedure A;
begin
  CallToDelphi;
end;

procedure B;
begin
  // do something
end;

I exposed the "CallToDelphi" procedure to a script. Therefore, when it is called, I returned from the script in my Delphi code. Now I want to call the script "B" procedure from my Delphi code. I think this should be hidden in the IdwsProgramExecution-Context. But I haven't found anything yet. I am looking for something like this:

procedure CallToDelphi;
begin
  Exec.Invoke('B', []); // Exec is IdwsProgramExecution
end;

How is this possible?

+3
source share
1 answer

What you are looking for is probably the IInfo interface, which can be used as

Exec.Info.Func['B'].Call([])

http://code.google.com/p/dwscript/wiki/FirstSteps ( ), (UdwsUnitTests , . CallFunc).

IInfo Delphi RTTI, , / , script .. .

+2

All Articles