Jump to content

Array Add question


Recommended Posts

  • Developers

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

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

  • Developers

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

  • Developers

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

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

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