SRL Archive - OSR Help

multi dimensional int array?


slushpuppy

2012-04-30 03:30:36

<slushpuppy> hm, why would this throw an error
<slushpuppy> function param: colorTols : array of array[0..1] of Integer
<slushpuppy> [[7307392,22],[4011829,22]] <– how i am calling it
<slushpuppy> er what data i am passing into it*
<slushpuppy> it can compile, but running it causes issues
<slushpuppy> is it possible that the PS interpreter doesn't allow for multidimensional int arrays



<Mayazcherquoi> slushpuppy: I don't believe you are allowed to set the second dimension of an array like that
<slushpuppy> eh
<slushpuppy> i hate these gotchas
<Mayazcherquoi> Well, not in PascalScript at least i believe.


I hope someone else can shed some light

masterBB

2012-04-30 03:39:45

function foo():Array of Array of Integer;
begin
Result := [[1,3,4,3],[2,3,1],[1243,325,21]];
end;
edit:
Nevermind, this only seems to work in lape.

edit: edit:
This is the only way, how ugly.
function foo():Array of Array of Integer;
begin
SetLength(Result,3);
Result[0] := [1,3,4,3];
Result[1] := [2,3,1];
Result[2] := [1243,325,21];
end;

slushpuppy

2012-04-30 05:32:48

From: masterBB
function foo():Array of Array of Integer;
begin
Result := [[1,3,4,3],[2,3,1],[1243,325,21]];
end;
edit:
Nevermind, this only seems to work in lape.

edit: edit:
This is the only way, how ugly.
function foo():Array of Array of Integer;
begin
SetLength(Result,3);
Result[0] := [1,3,4,3];
Result[1] := [2,3,1];
Result[2] := [1243,325,21];
end;


Oh god:(:mad::fiery:

Sex

2012-04-30 05:41:01


var
arr : array of array of integer;
begin
arr := [TIntegerArray([0, 1]), TIntegerArray([2, 3])];
writeln(arr);
end.