// =========================================================================== // Copyright 2018 Autodesk, Inc. All rights reserved. // // Use of this software is subject to the terms of the Autodesk license // agreement provided at the time of installation or download, or which // otherwise accompanies this software in either electronic or hard copy form. // =========================================================================== // // // // // // int floatArrayRemoveAtIndex(int $index, float[] $list) // // // Remove the entry at $index from the float array $list. // // // int $index The index of the element to remove from $list. // float[] $list A list of float values. // // // int : Returns false if $index was out of range and true on // success. // // // float $array1[] = { 1.0, 2.0, 3.0 }; // // Result: 1 2 3 // // floatArrayRemoveAtIndex(1, $array1); // // Result: 1 // // print $array1; // // Result: 1 3 // // // // global proc int floatArrayRemoveAtIndex( int $index, float $list[] ) { int $i; float $result[]; int $len = size( $list ); // Check for a valid index. // if ( $index >= $len || $index < 0 ) { return( false ); } // Copy any entries prior to $index. // for ( $i = 0; $i < $index; $i++ ) { $result[$i] = $list[$i]; } // Copy any items which come after $index. // for ( ; $i < $len - 1; $i++ ) { $result[$i] = $list[$i + 1]; } // Copy the result to the list argument. // $list = $result; return( true ); }