Script can't access variable / const of type TArray<Variant> from another script

Because my previous topic is closed, I repeat question from my last reply. This is not a serious problem, but I am interested in your explanation.

// unit1
const
  CArray = ['A','B','C'];

// unit2
uses
  unit1;
var
  V: Variant;
begin
  // compile error: Invalid array indexing for property 'CArray'. Expected 0 dimensions. Source position: 7,25
  // ShowMessage(CArray[1]);

  // Workaround
  V := CArray;                 
  ShowMessage(V[1]);
end;

TIA and best regards

That's a limitation indeed of script-based libraries. When accessing a variable from another script, you have to use that workaround, assigning the value to a local variable to access the indexes.

This topic was automatically closed 60 minutes after the last reply. New replies are no longer allowed.