wimhek Posted April 25, 2009 Share Posted April 25, 2009 Can I add the function arrayadd with a 2 dimension array , and if yes, how ? Link to comment Share on other sites More sharing options...
Developers Jos Posted April 25, 2009 Developers Share Posted April 25, 2009 you can do this by using redim and setting the newly created "sockets" in the array. This is what _ArrayAdd() does on a single dimension array. 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. Link to comment Share on other sites More sharing options...
wimhek Posted April 25, 2009 Author Share Posted April 25, 2009 you can do this by using redim and setting the newly created "sockets" in the array. This is what _ArrayAdd() does on a single dimension array. Thakks for your quick answer, but how can I do the redim ? I made this example : #include <Array.au3> dim $aaa[1][2] _ArrayDisplay($aaa) $aaa [0][0] = "Ape" $aaa [0][1] = "Nut" _ArrayDisplay($aaa) _arrayadd($aaa,"Mary") _ArrayDisplay($aaa) Link to comment Share on other sites More sharing options...
Developers Jos Posted April 25, 2009 Developers Share Posted April 25, 2009 You sure you looked in the helpfile? #include <Array.au3> dim $aaa[1][2] _ArrayDisplay($aaa) $aaa [0][0] = "Ape" $aaa [0][1] = "Nut" _ArrayDisplay($aaa) ReDim $aaa[1][3] $aaa [0][2] = "Mary" _ArrayDisplay($aaa) Jos 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. Link to comment Share on other sites More sharing options...
wimhek Posted April 25, 2009 Author Share Posted April 25, 2009 You sure you looked in the helpfile? JosJos of course I did, but what I want in the end is an arry in this structureRow Col0 Col10 Ape Nut1 Mary William Link to comment Share on other sites More sharing options...
Developers Jos Posted April 25, 2009 Developers Share Posted April 25, 2009 something like this should then work for you i guess: #include <Array.au3> Dim $aaa[1][2] _ArrayDisplay($aaa) _MyAddrayAdd("Ape", "Nut") _ArrayDisplay($aaa) _MyAddrayAdd("Mary", "Wim") _ArrayDisplay($aaa) Func _MyAddrayAdd($d1, $d2) ReDim $aaa[UBound($aaa) + 1][UBound($aaa, 2) + 1] $aaa[UBound($aaa) - 1][0] = $d1 $aaa[UBound($aaa) - 1][1] = $d2 EndFunc ;==>_MyAddrayAdd Enjoy, Jos 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. Link to comment Share on other sites More sharing options...
wimhek Posted April 25, 2009 Author Share Posted April 25, 2009 Enjoy, Jos Thnx it works, I deleted the +1 in the redim command to avoid adding columns. #include <Array.au3> Dim $aaa[1][2] _ArrayDisplay($aaa) _MyAddrayAdd("Ape", "Nut") _ArrayDisplay($aaa) _MyAddrayAdd("Mary", "Wim") _ArrayDisplay($aaa) _MyAddrayAdd("Sister", "Tony") _ArrayDisplay($aaa) Func _MyAddrayAdd($d1, $d2) ReDim $aaa[uBound($aaa) + 1][uBound($aaa, 2) ] $aaa[uBound($aaa) - 1][0] = $d1 $aaa[uBound($aaa) - 1][1] = $d2 EndFunc ;==>_MyAddrayAdd Link to comment Share on other sites More sharing options...
Developers Jos Posted April 25, 2009 Developers Share Posted April 25, 2009 You are right .... you see its easy once you get the hang of it. Jos 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. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now