JScript Array.push on Linux = Object doesn’t support this property or method


On Linux, Array.push will give you this error: “// ERROR : Object doesn’t support this property or method.” That’s because Softimage ships with an older version of JScript (5.1) on Linux.

You can add the following to your JScript to add a push method to the Array object:

// Add a push method to the JScript Array Object
// (Array.Push was added in Jscript 5.5 but we cannot rely on this)
// @cc_on
// @if (@_jscript_version < 5.5)
var push = function(){
	for( var i = 0; arguments[ i ] != null; i++ )
		this[this.length++] = arguments[ i ];
	return( this );
	}
Array.prototype.push = push;
// @end