Welcome to %s forums

BrainModular Users Forum

Login Register

script: 2-dimensional dynamic array?

I need help on a Patch
Post Reply
nelson
Member
Posts: 36
Contact:

Unread post by nelson » 30 Dec 2008, 17:03

its possible to make 2-dim. dynamic array?

d:array of array of integer;

how to set dimmenstions of array in script?

bmoussay
Member
Posts: 130
Contact:

Unread post by bmoussay » 30 Dec 2008, 20:02

Hi,

Have you tried:

type X: array of integer ;
var Y: array of X;
var i: integer;

for i:= 0 to n do
begin
Y:=X;
end;

Hope it can help,

Regards,

B.

amiga909
Member
Posts: 324
Contact:

Unread post by amiga909 » 31 Dec 2008, 15:10

dynamic array structures: there is nothing like that in the core elements of pascal script.
however you could build it a list/set-type thing with a procedure yourself - if needed.

set array lengths: there is setArrayLength(array, int)
// declaration as bmoussay wrote

// init a 16x16 matrix with value 1
setArrayLength(Y, 16);
FOR i := 0 TO 15 DO BEGIN
setArrayLength(Y, 16);
FOR j:=0 TO 15 DO BEGIN
Y[j]:=1;
END;
END;

amiga909
Member
Posts: 324
Contact:

Unread post by amiga909 » 04 Jan 2009, 20:31

bmoussay wrote:Hi,

Have you tried:

type X: array of integer ;
btw: should be
type X =array of integer; // '=' instead of ':'
var Y : array of X;

Post Reply

Who is online

Users browsing this forum: No registered users and 46 guests