I have a DWScript like this
var Outputter: TOutputter;
procedure OutputterTester;
begin
Outputter.Print;
end;
TOutputter (is only a example for a complex class) is declared and created in delphi code and exposed to the DWScript via Rtti.
TOutputter = class
procedure Print;
end;
I want to use the compiled script for several instances, but change the value Outputter that it link to current instance. I know i can access a script variable with:
var Exec : IdwsProgramExecution;
...
AVar := Exec.Info.Vars['Outputter'].Value;
But the value is a Variant so i can't assigne a object. How can I change the value? If i first create the class in script like:
procedure Init;
Outputter := TOutputter.Create;
end;
I can assign Exec.Info.Vars['Outputter'].ScriptObj.ExtObject a arbitrary instance of TOutputter (created in delphi code) and access them in scriptcode over Outputter. But i want to assign a delphi code created instance of TOutputter without the init part.
Thank you for help!