SRL Archive - News and General

Declare Arrays Globally..


Brandon

2011-07-18 15:29:08

You know how you can declare constants globally like:


const
blah blah = ##;

How do I do that with an array of integers? Like an array of constant ID's:


const
GateID = [3506, 3507]; //Doesn't work..

var
GateID = [3506, 3507]: Array of Integers //Doesn't work.

I tried searching all the tutorials I know of but none of them do this.. instead they do it in the procedures themselves.. So Help me please.

NCDS

2011-07-18 15:49:18

You just have to do it in the main loop, not when declaring it. :)


program ArrayStuff;
var
intArray: TIntegerArray;

//Main Loop
begin
intArray := [{values}];
//rest of main loop
end.

BraK

2011-07-18 16:48:08

…Or any subsequent Procs and Funcs. It doesn't have to be the Mainloop…

Just adding onto NCDS's explanation.

~BraK

masterBB

2011-07-18 18:39:03

So you can't make a array const? That would be odd…

senrath

2011-07-18 18:43:19

It's something to do with how PascalScript works, IIRC. I ran into that problem a while ago.

nielsie95

2011-07-25 14:06:42

Unfortunately, Pascal Script does indeed not support this.