Trying to create an class array with two properties

Hi:

I’m trying to create a javascript (not builtin) array that has two properties. The variable arrays are called p1 and p2. So I’m trying to add values to the properties in the array. However, when I’m adding values (num and suit) to the array (using push) I get the following error message:

MissingMethodException: card.Push

Here’s the following code. I’m sorry if I’m not being clear. If you have any questions, please ask. I’m trying to get this simple code to execute first before school tomorrow, so I’ll be checking this page often.

Thanks!

//create number and suit classes for p1 and p2.
class card {
	var num;
	var suit;
	function card (n,s) {
		num = n;
		suit = s;
	}
}

var p1 : card[];
var p2 : card[];

//nu is number and su is suit.

var nu;
var su;

function shuffle (nu,su) {
	p1.Push(nu,su);
}

function Start () {
	Debug.Log ("shuffle start");
	shuffle(1,"S");
	Debug.Log ("shuffle end");
	Debug.Log (p1.suit);
}

A card[] has fixed length. If you want a structure with dynamic length, you might instead use a List.

Handy reading on the Unity wiki, including sample code: Which Kind Of Array Or Collection Should I Use?