Array does not convert to builtin array

Hi,

I want to extract values from a xml string. I am interestet in some IDs, which are instance IDs of Unity game objects. So I collect them in an array as strings in the first place. Befor I iterate through them, I convert the array to a builtin array. To compare the collected IDs with the ones in my scene I have to convert the strings to integer values, but in the line with parseInt(…) the compiler tells me:
BCE0023: No appropriate version of ‘UnityScript.Lang.UnityBuiltins.parseInt’ for the argument list ‘(Object)’ was found.

But shouldn’t they be strings and not objects? Waht am I doing wrong?

			var instanceIDs_Array : Array = new Array();
			do {
				var errorNavigator = navigator.Clone();
				errorNavigator.MoveToFirstChild(); 
				var id : String = errorNavigator.Value;
				instanceIDs_Array.Add(id);
			}while(navigator.MoveToNext());
			var instanceIDs = instanceIDs_Array.ToBuiltin(String);
			for(obj in allObjects) {
				for(var i : int = 0; i<instanceIDs.length; i++) {
					var instanceID : int = parseInt(instanceIDs[i]);
					if(instanceID==obj.GetInstanceID()) {
                                                         ...
					}
				}
			}

I always found the type system that Javascript uses to be too ambiguous for my liking.

You’ll solve your problem if you cast instanceIDs to a string manually.

It’s better if you use List., then you don’t have to bother with Array (which is generally obsolete) and converting to builtin arrays.

It’s the same system that C# uses, even if the syntax is a little different.

–Eric