Return array from obj method...

Hello,

Delphi 10.2, current version of scripter.

type
 TVariantArray = array of variant;

I have an obj:

type
 TDrawObject = class
public
 function GetIDS:TVariantArray;
end;

I register the calls with DefineClassByRTTI. (sdo is the class instance variable name).

Complies, no error, but when I return the array at runtime I get a type cast error in the script.

function TDrawObject .GetIDS:TVariantArray;
begin
 SetLength(result,1);
 result[0]:='-1';
end;

Invalid class typecast when evaluating instruction CallProc ($FFFFFFFF,$0,$105C090,$6889510,'GetIDS'

I began attempting to return a dynamic array of string but no joy so switched to variants. This works with a similar Scripter.DefineMethod.

But I like in the script that the user can call values:=sdo.GetIDS; Making the call a separate method breaks the "object" model.

What am I doing wrong? Ideas?

Thanks,

Mark




I changed the result type to variant and used VarArrayCreate and had success.