SRL Archive - OSR Help

Declaring T(>3)DIntegerArray's


TomTuff

2011-01-10 05:21:46

First off, this is difficult to word, so be warned!

Declaring any series of "array of"'s more than 3 times of Integer arrays (TERRIBLE wording) manually gives a type mismatch error.

Allow me to present some code for what i mean…

program new;

type
T4DIntegerArray = array of array of array of array of Integer;

var
TheArray: T4DIntegerArray;

procedure SetExampleT4DIntegerArray;
begin
TheArray :=
[
[
[
[0, 1], [1,0]
]
]
];
end;

begin
SetExampleT4DIntegerArray;
end.

If you comment the only line in the main loop, it compiles on runtime so it must be declared properly. However, leaving it uncommented gives a type mismatch error.

I know i can do this using a series of types, but filling in a long series of with..do's is too much for someone who has little programming knowledge (My dad wants this for a script for Evony).

Now that I think about it, this should probably be in the Simba bugs section, but this section works fine too.

Regards!

Dgby714

2011-01-10 07:19:06

WFM

Simba doesn't like arrays inside of arrays "[[]]".
Instead of settings it like that use
"Arr[X] := [];"

program new;

type
T3DIntegerArray = array of T2DIntegerArray;
T4DIntegerArray = array of T3DIntegerArray;

var
TestArr: T4DIntegerArray;

begin
SetLength(TestArr, 1);
SetLength(TestArr[0], 1);
SetLength(TestArr[0][0], 1);
TestArr[0][0][0] := [1, 5, 8];
WriteLn(TestArr);
end.

TomTuff

2011-01-10 08:13:16

WFM?

And okay, that works I guess.

RISK

2011-01-10 08:22:02

WFM = Works For Me

From: TomTuff
WFM?

And okay, that works I guess.

Nava2

2011-01-10 11:30:53

You can also do:

var
2darr: T2DIntegerArrary;
begin
2DArr := [TIntegerArray([0,3,3,4])];
end;

lordsaturn

2011-01-10 12:22:28

From: Nava2
You can also do:

var
2darr: T2DIntegerArrary;
begin
2DArr := [TIntegerArray([0,3,3,4])];
end;


Horray!!! :D