Is not a member of object

I seem to know the reason why i am getting this error but i dont know how another way to solve this, the problem is giving error saying “name” and “quantity” is not a member of this object.

    internal var myDrugs = new Array();
    
    function buyDrug(drug : Drug) {
    	myDrugs.push(drug);
    }
    function getDrugs(index : int) {
    	return myDrugs[index];
    }
    function getDrugsLength() { 
    	return myDrugs.length; 
    }
    function sellDrug(name : String, amount : int) {
    	for (var i = 0; i < myDrugs.length; i++) {
    		if (myDrugs*.name == name) {*

_ if (myDrugs*.quantity <= amount) {_
_ myDrugs.quantity -= amount;
}
if (myDrugs.quantity == 0) {
myDrugs.RemoveAt(i);
}
}
}
}*_

Don’t use the ‘Array’ class. For what you are doing here, the .NET List class is a good choice. More information on the various collection types:

http://wiki.unity3d.com/index.php?title=Which_Kind_Of_Array_Or_Collection_Should_I_Use?

To use the List class you will need this at the top of the file:

import System.Collections.Generic;

and you will declare it:

var myDrugs : List.<Drug> = new List.<Drug>();

And it will be ‘Add’ not ‘push’ to put them in the list.