anymore1113 / superobject

Automatically exported from code.google.com/p/superobject
0 stars 0 forks source link

Add and check array in ISuperObject #51

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Add array
o.A['Test'] := - is read-only
o.A['Test'].S[0]:='Test' - error
o['Test'].asArray.S[0]:=... - error

how to add array to object?

and how to check object to exist array 'test' in therein???
o.A['Test'].DataType - error

Original issue reported on code.google.com by mixa_sup...@mail.ru on 25 Dec 2013 at 12:38

GoogleCodeExporter commented 9 years ago
You add arrays using o.O['Test'] := SA(['1','2','3'])
If you have a predefined array, use something like this:
var
  n: integer;
  arr: array of TVarRec;
begin
  for n := 0 to Count-1 do
  begin
    arr[n].VType := vtAnsiString;
    arr[n].VAnsiString := pointer(yourstring);
  end;
  o.O['Test'] := SA(arr);
end;

or just
  o.O['Test'] := SA([]);
  and then o.A['Test'].S[0] := 'test';

Original comment by atle.pub...@gmail.com on 6 May 2014 at 7:23