TextAsset inside the Array - UnityScript/JavaScript

Hello i have a question regarding Arrays.
Let’s say i have a CSV file called weapons, i changed that CSV file into a TextAsset file and i would like to have an Array which will hold all my weapons from this TextAsset file and then in my function i will iterate through this Array to create a random number of items.

var weapons        :   TextAsset;
var itemsListArray :   Array;

function  InitialiseArray() {
	itemsListArray = new Array ();

private function CreateRandomItemsFromArray() {
  var total : int = Mathf.Clamp(Random.value * 10, 4, 10);
	for(var _cnt : int = 0; _cnt < total; _cnt++) {
            var	temp : int = Random.value * 24;
		    //Debug.Log(_cnt + " -- " + itemsListArray);

When i am passing weapons as a parameter in itemsListArray = new Array ();
i am getting this error, but the items are being printed in Console.

InvalidCastException: Cannot cast from source type to destination type.
Boo.Lang.Runtime.RuntimeServices.CheckNumericPromotion (System.Object value)
Boo.Lang.Runtime.RuntimeServices.UnboxInt32 (System.Object value)

Also inside the window which is being opened to create random set of items. My first GUI Button is empty ad the rest of them are having integer values from CreateRandomItemsFromArray function

Never use the Array class. Use a generic List, then you won’t have those casting issues, plus it’s much faster and better. Also you can just use Random.Range instead of using Random.value like that.