Jump to content

Question about arrays in arrays in arrays.......


Recommended Posts

I have noticed the following happen:

(not exact code but sth to this effect)

Dim $array[5]
Dim $array2[4]
$array[0] = $array2

_DoSomethingSpecial($array)

_DoSomethingSpecial 's function header is _DoSomethingSpecial($a) <<NO ByRef

Then when i modify $array[0] in _DoSometingSpecial, it somehow manages to edit BOTH $array2 AND $array[0]!!!

Why? Is it because AutoIt uses sort of "pointers" in it's storing mechanism for arrays?

???

#)

Link to comment
Share on other sites

I have noticed the following happen:

(not exact code but sth to this effect)

Dim $array[5]
Dim $array2[4]
$array[0] = $array2

_DoSomethingSpecial($array)

_DoSomethingSpecial 's function header is _DoSomethingSpecial($a) <<NO ByRef

Then when i modify $array[0] in _DoSometingSpecial, it somehow manages to edit BOTH $array2 AND $array[0]!!!

Why? Is it because AutoIt uses sort of "pointers" in it's storing mechanism for arrays?

???

#)

it depends on what's going on in _DoSomethingSpecial...
Link to comment
Share on other sites

I have noticed the following happen:

(not exact code but sth to this effect)

Dim $array[5]
Dim $array2[4]
$array[0] = $array2

_DoSomethingSpecial($array)

_DoSomethingSpecial 's function header is _DoSomethingSpecial($a) <<NO ByRef

Then when i modify $array[0] in _DoSometingSpecial, it somehow manages to edit BOTH $array2 AND $array[0]!!!

Why? Is it because AutoIt uses sort of "pointers" in it's storing mechanism for arrays?

???

#)

Strip it down to a minimum amount of working code that will demo the symptom and post it. But, I'll bet in the process you come across the answer anyway. :geek:

I've done that a couple of times already, found the answer while trying to code a good example of the problem... :o

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...