Jump to content

Recommended Posts

Posted

hi all !

can someone can help me explan why i can do this :

dim $test

$test[0] = 1

that return :

test.au3 (2) : ==> Badly formated variable or macro.:

$test[0] = 1

$test^ ERROR

because i don't like create a very large array ( ie : dim $test[999] )

they are no solution for create a dynamicaly extentable array ?

hope my explanation was clear :o

  • Moderators
Posted

hi all !

can someone can help me explan why i can do this :

dim $test

$test[0] = 1

that return :

test.au3 (2) : ==> Badly formated variable or macro.:

$test[0] = 1

$test^ ERROR

because i don't like create a very large array ( ie : dim $test[999] )

they are no solution for create a dynamicaly extentable array ?

hope my explanation was clear :o

Have a script to look at?

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Posted

Probably because you are not creating $test as an array to start with, then trying to access it as an array.

I think that I usually _ArrayCreate.

i.e. (untested)

dim $test = _ArrayCreate ( 1 )

“Give a man a script; you have helped him for today. Teach a man to script; and you will not have to hear him whine for help.”AutoIt4UE - Custom AutoIt toolbar and wordfile for UltraEdit/UEStudio users.AutoIt Graphical Debugger - A graphical debugger for AutoIt.SimMetrics COM Wrapper - Calculate string similarity.

Posted (edited)

ok grafost,

as i understand, the only solution is to do a resize of the array for each element i need to insert..

thanks !

Edited by pinkfoyd
Posted

Hi!

I am not sure about the last post. How do you resize an array?

If what I think is you mean to do is

$test = _ArrayCreate ( 1 )

;later wen I need to resize
$test = _ArrayCreate ( 2 )

Will resizing an array everytime reset it's variable?

That is to say, if I have created an array of size 1 having a value say "name" and then I resize it to 2 as shown above, will the value of array[1] still be "name"?

I believe we should all pay our tax with a smile. I tried - but they wanted cash!

  • Developers
Posted

Will resizing an array everytime reset it's variable?

That is to say, if I have created an array of size 1 having a value say "name" and then I resize it to 2 as shown above, will the value of array[1] still be "name"?

Remarks

The ReDim keyword is similar to Dim, except that ReDim preserves the values in the array instead of removing the values while resizing an array. The number of dimensions must remain the same, or the old array will be forgotten during the ReDim. The array will retain the scope (Global or Local) that it had prior to resizing.

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Posted

Yeah...got it!

Thanx ChrisL and JdeB for the infos.

This seems to be a nice feature...gonna experiment with it more.

I believe we should all pay our tax with a smile. I tried - but they wanted cash!

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
  • Recently Browsing   0 members

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