classes and strings

i am learning how to use methods and classes.
this is my first attempt :sweat_smile:

here is my class

class objectData extends Object{

	//name of the system
	var name : String;
	
	//tag of the system
	var tag : String;
	
	//is system loaded
	var isLoaded : boolean;
	
	//is system isolated
	var isVisible : boolean;
	
	//is system visible
	var isIsolated : boolean;
	
	//is system transparent
	var isTransparent : boolean;
	
	
}

so i am declaring class like this:

var objects : objectData[];

also i entered length of the array using inspector. also names and tags are initiliazed in the same way.
the problem is when i want to change some of the values. i need to use objects[1] or objects[2]… can i do it simplier, with the name or something?

also how to put methods in the class? is there any simple example?

thanks!

You can declare methods simply as:

class objectData extends Object
{

	function myFunction()
	{
		//do stuff
	}
	
	function add(number1, number2)
	{
		 return (number1 + number2);
	}
}

To use string names, I’m not too sure. I don’t know if JavaScript has a concept of typed dictionaries like C#. Or if it allows you to define indexed getters/setters like C#. I’ll have to leave that to someone else to comment on.