Jump to content

_ArrayDeclareFromString, _ArrayToDeclarationString, _ArrayShuffleMultiDim, _ArrayCompare, _ArrayEnumValues, _ArrayAssign, ...


Recommended Posts

Posted

I like the idea of _ArrayToDeclarationString() - that is a very useful concept. One suggestion - I think you could add more information about dimension limitations in the comments to these functions. How many dimensions does _ArrayToDeclarationString() cater for?

Posted

Nice! :)

Local $aSubjects = [[["Art"],["Painting",2,7],["Music",2,3],["Drama",3,4],["Dance",1,10]],[["Science"],["Maths",6,6],["Physics",5,1],["Chemistry",5,6],["Biology",5,6]],[["Sport"],["Football",12,8],["Golf",4,0],["Snooker",1,1],["Chess",10,0]]]

 

Posted

Thanks.
Now, you can do the reverse, build the array from a string :

$array = _ArrayDeclareFromString('[[["Art"],["Painting",2,7],["Music",2,3],["Drama",3,4],["Dance",1,10]],[["Science"],["Maths",6,6],["Physics",5,1],["Chemistry",5,6],["Biology",5,6]],[["Sport"],["Football",12,8],["Golf",4,0],["Snooker",1,1],["Chess",10,0]]]')
$aEnum = _ArrayEnumValues($array) ; useful for arrays > 2 dimensions
_ArrayDisplay($aEnum)

 

  • 3 years later...
Posted

Hello yy, I searched for what felt like forever until I found this brilliant script! What a great job! 👋

I haven't been working with Autoit for long and I'm having a lot of trouble reading into other people's scripts and even more problems understanding them. 

So I have a question: I would like to use the "_ArrayAssign" function in a "for ... next" loop and add a new line to the array with each new loop. What would be the easiest way to do this?

Thanks in advance

Posted

Hello @Celina76.

Thanks for your message.

In fact, the _ArrayAssign function is only useful in very rare cases. I think you have a 99.9% chance of not needing it.
I advise you to use the native array declaration method, and in particular ReDim which will allow you to resize an array and therefore add rows easily

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...