how to manually register overloaded methods?

is it correct that the only way to register "overloaded" methods - is to register them using different names?

Not exactly. You define a method and then you implement it as you want, being aware that scripter doesn't check types. You can also define the number of default parameters, meaning you can register that a method receives from a X to X+n number of parameters.

Once you have defined a method, in the implementation you can do whatever you want, for example, checking the number of parameters passed, or even check the type of passed parameter, and call the Delphi overloaded method that works best for the passed parameters.

Hmmm.. Ok. It sounds reasonable.

Can you please provide example (if it is possbile) on how to register following procedures:

procedure test123(var a1, a2, a3: string); overload;


procedure test123(var a1: string); overload;


I tried the following:

    with Scripter.DefineClass(TSomeMyClass) do
      DefineMethod('test123', 3, tkVariant, nil, __TfwfDreamDialogsPickNewDokTips, False, 2, 'a1, a2, a3: string').SetVarArgs([0,1,2]);

But it failed with ListIndexOutOfBounds in editor (when hit Ctrl+Shift+Space) or when run if only 1st param is specified. (test123(s1))

In this specific case, there is a limitation, indeed. Parameters passed by reference (var) can't be default (omitted), unfortunately.