﻿id	summary	reporter	owner	description	type	status	milestone	component	version	severity	resolution	keywords	cc
2564	UDF - _ArrayInsert - proposal	mlipok		"'''now is'''
{{{
Func _ArrayInsert(ByRef $avArray, $iElement, $vValue = """")
	If Not IsArray($avArray) Then Return SetError(1, 0, 0)
	If UBound($avArray, 0) <> 1 Then Return SetError(2, 0, 0)

	; Check element in array bounds + 1
	If $iElement > UBound($avArray) Then Return SetError(3, 0, 0)

	; Add 1 to the array
	Local $iUBound = UBound($avArray) + 1
	ReDim $avArray[$iUBound]

	; Move all entries over til the specified element
	For $i = $iUBound - 1 To $iElement + 1 Step -1
		$avArray[$i] = $avArray[$i - 1]
	Next

	; Add the value in the specified element
	$avArray[$iElement] = $vValue
	Return $iUBound
EndFunc   ;==>_ArrayInsert
}}}

'''proposal:'''

change:
{{{
	; Check element in array bounds + 1
	If $iElement > UBound($avArray) Then Return SetError(3, 0, 0)

	; Add 1 to the array
	Local $iUBound = UBound($avArray) + 1
	ReDim $avArray[$iUBound]
}}}

to


{{{
	; Check element in array bounds + 1
	Local $iUBound = UBound($avArray)
	If $iElement > $iUBound Then Return SetError(3, 0, 0)

	; Add 1 to the array
	$iUBound += 1
	ReDim $avArray[$iUBound]
}}}
'''because:'''
small clarification 
and faster (only once uses the UBound($avArray) )
"	Feature Request	closed		Standard UDFs		None	Rejected		
