Sign in to follow this  
Followers 0
Glyph

Newb question with multi-dimensional array

4 posts in this topic

#1 ·  Posted (edited)

$max = 101
$array[$max][2] ; 0 = socket, 1 = username

for $i = 0 to $max ; loop until u find an open array
if not $array[$i][1] then
_arrayadd($array[$i][0],"socket") ; Is this the correct way to array add to a multi dimensional array?
_arrayadd($array[$i][1],"user1") ; Is this the correct way to array add to a multi dimensional array?
$i = $max
endif
nextoÝ÷ جƥ(·öl(׫x!£hi×]jÖ­¢Ø^jºÚË^Ø^­íý²j+zØZWbéìÓéá£hué^µè­#ozÚâyÛaƧv-ýz-²êÞûaȬ¶©®^¯²¶hÖ®¶­seö'&FVÆWFRb33c¶'&²b33c¶Ò²6÷VÆBFVÆWFR&÷FVÆVÖVçG2âFRb33c¶'&ð

Edited by BackStabbed

tolle indicium

Share this post


Link to post
Share on other sites



array.au3 include file only supports single dimension arrays

You have to write your own logic to use a multidimensional array.

* Adding by using redim

* deleting by shifting yourself to the right spot

$array[1][2] ; 0 = socket, 1 = username

$array[0][0]="socket"

$array[0][1]="user1"

Share this post


Link to post
Share on other sites

The Array.au3 UDF supports 2D arrays for most functions in the 3.2.11.x Beta versions. In the 3.2.10.0 Production version, _ArrayDelete() is 1D only, but it is 2D in the Beta:

; Fails in Prod, Works in Beta
#include <Array.au3>
Global $avArray[4][2] = [[1, 2], [10, 20], [100, 200], [1000, 2000]]
_ArrayDelete($avArray, 2)
_ArrayDisplay($avArray, "$avArray")

:D


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites

The Array.au3 UDF supports 2D arrays for most functions in the 3.2.11.x Beta versions. In the 3.2.10.0 Production version, _ArrayDelete() is 1D only, but it is 2D in the Beta:

; Fails in Prod, Works in Beta
#include <Array.au3>
Global $avArray[4][2] = [[1, 2], [10, 20], [100, 200], [1000, 2000]]
_ArrayDelete($avArray, 2)
_ArrayDisplay($avArray, "$avArray")

:D

I like u!

hope _ArrayToString also can work in multi-demensional arrays..

http://www.autoitscript.com/forum/index.php?showtopic=69916

Share this post


Link to post
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
Sign in to follow this  
Followers 0