I am having an issue with returning an array

I am having an issue with rturning an array from a function and storing that in a var. the error is.

NullReferenceException: Object
reference not set to an instance of an
object screengui.SkillBox (Int32 x,
Int32 y) (at Assets/screengui.js:26)
screengui.OnGUI () (at
Assets/screengui.js:15)

the following is my code.

// from GUIData
function GetData( prof:int, branch:int, level:int) : Object{
	...
	var data = [ "", 0, "Novice Brawler", 88, 15 ];
	return data;
	...
}

var data:Object[] = []; // line 25
data = dataset.GetData( 0, 0, 0 ); //line 26

I have tried type casting data and the GetData function but it still errors out. This should be pretty simple but I have no idea why this is happening. All I want is to pass an array to a var. The Data var that is returned will be different based on the input of the function. Can someone tell me what I am missing?

Object with a capital letter is UnityEngine.Object; none of the stuff in your array is that. Use a lowercase o.

Also, you’re returning Object and not Object.

I really doubt you want to use that code, but those are your problems.

I was able to figure it out. I tried moving GetData into the same file and calling it from there, that worked just fine. After recoding it back to separate files I was still getting the “NullReferenceException”, I figured the dataset varible was not being properly instantiated. I read http://answers.unity3d.com/questions/24515/How-to-create-a-new-class.html; I found that to be quite helpfull. If there is anyone out there that runs into the same problem I did I will attach my new code so that others may find it useful.

class GUIData {

	function GUIData() {
		
	}
	
	function GetData( prof:int, branch:int, level:int) {
		var data = [ "", 0, "Novice Brawler", 88, 15 ];
		return data;
	}

}

var dataset:GUIData = new GUIData();
var data = dataset.GetData( 0, 0, 0 );