www array, help?

OK so i need to read a string, divide it to an array, the string will contain urls that i need to download and put in another array, and it will use eval() to execute them. so here’s my code:

var mods:String;
var modlist:String[];
var temp1:int = 0;
var www:WWW[];

function Start() {
    mods = PlayerPrefs.GetString("mods");
    modlist = mods.Split(","[0]);
    while (temp1 < modlist.length) {
        www[temp1] = new WWW (modlist[temp1]);
        yield www[temp1];
        temp1++;
    }
    temp1 = 0;
    var modtext:String[];
    while(temp1 < modlist.length) {
        modtext[temp1] = www[temp1].text;
        eval(modtext[temp1]);
    }
}

then it says:

NullReferenceException: Object reference not set to an instance of an object
(wrapper stelemref) object:stelemref (object,intptr,object)
mods+$Start$24+$.MoveNext () (at Assets/Scripts/mods.js:34)

First thing I noticed:

var www:WWW[];

You’ve declared an array reference, but did you ever assign a value?

If you find built-in arrays confusing, you might want to try Unity’s Array class.

Also, looking at this bit of your error message:

Assets/Scripts/mods.js:34

This indicates the error is occurring on line 34 of a file named mods.js. Which line is that? Is it included in your code sample, above?

Finally, looking at this bit of your question:

it will use eval() to execute them

Does UnityScript support eval()? In a quick search, it seems like support for it was partially or completely broken since 3.x. Even if it’s something you could do, I have a feeling it’s probably not a good idea.