Jump to content

Recommended Posts

Posted

I was playing with arrays inside of arrays and I figure out how to get to the the array 1 down from the mother array so to speak. How do i get to the arrays farther down the line then 1 from the top most array.

Here is the code I been playing with.

#include <array.Au3>
Dim $arraya[2]
Dim $arrayb[2]
Dim $arrayc[3]
dim $arrayd[2]

$arrayd[0] = "arrayd0"
$arrayd[1] = "arrayd1"

$arrayc[0] = "arrayc0"
$arrayc[1] = "arrayc1"
$arrayc[2] = $arrayd

$arrayb[0] = "arrayb0"
$arrayb[1] = "arrayb1"

$arraya[0] = $arrayb
$arraya[1] = $arrayc


For $i = 0 to 1
MsgBox(0,"",$arrayb[$i])
Next
For $i = 0 to 1
MsgBox(0,"",$arrayc[$i])
Next
;For $i = 0 to 1
;MsgBox(0,"",$array[$i])
;Next
MsgBox(0,"",ubound($arraya[1]))
_ArrayDisplay($arraya[1],"")
_ArrayAdd($arraya[1],"new")
_ArrayDisplay($arraya[1],"")
_ArrayDelete($arraya[1],1)
_ArrayDisplay($arraya[1],"")
;how do i get it to display the $arrayd from $arraya[1]
;in other words get to $arrayd though $arrayc though $arraya

.

Posted (edited)

This is not what you are asking perhaps, but something to consider:

#include <array.Au3>
Dim $MDRA [2] [2] [3] [2]
$a = 1
$b = 2
$c = 3
$d = 4
$sp = " "

Func InitMDRA()
    For $ai = 0 To UBound($MDRA, $a) - 1
        For $bi = 0 To UBound($MDRA, $b) - 1
            For $ci = 0 To UBound($MDRA, $c) - 1
                For $di = 0 To UBound($MDRA, $d) - 1
                    
                    $MDRA [$ai] [$bi] [$ci] [$di] = "Array Location " & _
                            "A" & $ai & $sp & _
                            "B" & $bi & $sp & _
                            "C" & $ci & $sp & _
                            "D" & $di
                Next
            Next
        Next
    Next
EndFunc  ;==>InitMDRA

J

Edited by jdickens

If I am too verbose, just say so. You don't need to run on and on.

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