These are instances of classes (objects):
procedure Teditor.ceCompile(Sender: TPSScript);
begin
Sender.AddMethod(Self, @TEditor.Writeln, ‘procedure writeln(s: string)’);
Sender.AddMethod(Self, @TEditor.Readln, ‘procedure readln(var s: string)’);
Sender.AddRegisteredVariable(‘Self’, ‘TForm’);
Sender.AddRegisteredVariable(‘Application’, ‘TApplication’);
end
And the instruction used is AddRegisteredVariable, not AddVariable))))
These are assignments of Objects:
procedure Teditor.ceExecute(Sender: TPSScript);
begin
ce.SetVarToInstance(‘SELF’, Self);
ce.SetVarToInstance(‘APPLICATION’, Application);
Caption := STR_FORM_TITLE_RUNNING;
end;
And the instruction is CSetVarToInstance not VSetInt nor some similar.
Let me lought about this thread, but… as complicated can be get as response something concrete?
A concrete example about how to insert/create from Delphi source a variable of a single type (Integer, string, Extended, etc.)
I need to create this variable to be used inside the script, but I have not a variable outside it.
After the code is executed, I need to recover his value and put it into a variable of my delphi code, that can have other name or can be a property of a class, that the Pascal Script do not know.
It’s possible. I’m sure. But I can’t find an example or a document entry about this.
The more near I have is in the wiki that say:
… you have to use the AddRegisteredVariable Function…
this AddRegisteredVariable function does not exists in the current version of PascalScript. Exists AddVariable, but… I can’t understand his second parameter.
An example please!!! I beg an example!!!
Thank you!