Sign in to follow this  
Followers 0
WoodGrain

Dynamic Arrays

3 posts in this topic

Hi,

i'd like to do a number of things with Arrays dynamicaly.

i've tried a number of things & have read the help file a couple of times..

1. How do i create a blank array?

Do i just Dim it like i would any other variable? ie, when i use "_ArrayAdd" will it convert the variable to an array?

2. Will _ArrayAdd add to the array dynamically, w/o having to expand the array or w/o having to previously define the number of elements?

3. How do i access an element in an array?

is it $myElement = $myArray[$i]; (Where $i is the number of the array's element i wish to access)

Thanks.

Share this post


Link to post
Share on other sites



1. How do i create a blank array?

Do i just Dim it like i would any other variable? ie, when i use "_ArrayAdd" will it convert the variable to an array?

<{POST_SNAPBACK}>

Dim $Array[100]

2.  Will _ArrayAdd add to the array dynamically, w/o having to expand the array or w/o having to previously define the number of elements?

<{POST_SNAPBACK}>

Yes but just open the Helpfile for _ArrayAdd info....

3. How do i access an element in an array?

is it $myElement = $myArray[$i]; (Where $i is the number of the array's element i wish to access)

<{POST_SNAPBACK}>

Correct...

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

ok, i seem to have it under control now.

my problem was i was trying to Dim the array with 0 elements "Dim myArray[0]"

it's anoying that we can't just create a blank array.

so my hack for it was:

Dim $myArray[1]

... add elements dynamically (which add from element 1 onwards) ...

then start the retrieval loop from element 1 instead of 0

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