View Full Version : Declaring an array to achieve global scope

10-15-2012, 09:13 PM

Sorry for yet another newbie lscript question:

I can declare variables to get global scope (Templates / Generic - placed under '// global values go here').

But I get a syntax error if I try to place an array there. The same array declaration placed elsewhere, however, doesn't produce the syntax error. (But then it doesn't have the global scope I need it to have).

Why can't I declare a global array as I can with variables? How to do so?


10-15-2012, 09:26 PM
Below I have 2 examples. One is initializing an empty array and the other is initializing an array with values. The first array is then set in the generic part of the script. Finally one value from each array is displayed using info. I hope this answers your question.

@version 2.2
@script generic

myArrayB = @"d","e","f"@;

myArray = @"a","b","c"@;
info(myArray[1] + " " + myArrayB[3]);

10-15-2012, 09:40 PM
It works, thank-you!