Sign in to follow this  
Followers 0
AnnA

_ArrayPush UDF does not return expected values

2 posts in this topic

First time having to ask something that I could not find after enough searching through the forums.

I was under the impression that the result of Func _ArrayPush(ByRef $avArray, $sValue, $i_Direction = 1) will be $sValue at the location $avArray[0] and each original value from $avArray[0] to $avArray[2nd last] will be moved up one position.

e.g. Array with 1,2,3,4,5 --- Push 8 with direction 1 will result in 8,1,2,3,4

Currently it returns 8,2,3,4,5

In the UDF the line is :-

"For $i = (UBound($avArray) - 1) To 1"

Shouldn't it be

"For $i = (UBound($avArray) - 1) To 1 Step -1"

for the loop to be effective at all?

-I'm sorry if this is a stupid question but the help file says

"A For loop will execute zero times if:

start > stop and step >= 0"

-AnnA

Share this post


Link to post
Share on other sites



First time having to ask something that I could not find after enough searching through the forums.

I was under the impression that the result of Func _ArrayPush(ByRef $avArray, $sValue, $i_Direction = 1) will be $sValue at the location $avArray[0] and each original value from $avArray[0] to $avArray[2nd last] will be moved up one position.

e.g. Array with 1,2,3,4,5 --- Push 8 with direction 1 will result in 8,1,2,3,4

Currently it returns 8,2,3,4,5

In the UDF the line is :-

"For $i = (UBound($avArray) - 1) To 1"

Shouldn't it be

"For $i = (UBound($avArray) - 1) To 1 Step -1"

for the loop to be effective at all?

-I'm sorry if this is a stupid question but the help file says

"A For loop will execute zero times if:

start > stop and step >= 0"

-AnnA

Sounds like you found a BUG in the _ArrayPush() UDF. Will update it in the next release....

Thanks

:P


Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0