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

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s