My script is:
<?
$x := foo(3);
$y := foo(1);
?>
x = <? $x.count ?>
y = <? $y.count ?>
function foo, just return an array contains records as below:
procedure TForm1.RtcFunction1Execute(Sender: TRtcConnection; Param: TRtcFunctionInfo;
Result: TRtcValue);
var
i: Integer;
begin
Param.map(0, 'i');
with Result.NewArray do begin
for i := 0 to Param.Value['i'] - 1 do begin
with NewRecord(i) do begin
asInteger['id'] := i;
asString['name'] := 'N' + IntToStr(i);
end;
end;
end;
end;
after executed:
x = 3
y = 2 <-- WRONG, ought to be 1
if it's a simple array(contains integer or string), the count is right, it goes wrong only when the element of array is record.