Jump to content
Sign in to follow this  

Creating an Array with Nothing

Recommended Posts

I'm writeing a function that adds to an Array a list of words. At the end of the function, the Array CAN be empty, and what I would like is for that to happen, so that I can just test how many variables are in the Array, and if there are 0, then there is was an error. So what I wanted to do was create an "Array" at the top of the function, and go through the checks that do or do not add words to the list. Problem is, there is no way to create an $Array[0], and _ArrayAdd( $, $) wont add to a non Array, $Array. I tried doing a Dim $Array; because I looked in Array.au3 and saw that it ReDim's the variable, but apparently ReDiming only works on a previous array. Is the only way arround this be to create my own Link List type deal? or.. ? Another question I have is handleing variable's with shallow and deep copy, I have run into a few times where I have found that AutoIt likes its Shallow Copy. (My termonology may be wrong) what I am refering to is how can I take the physical memory location of $bob and make $bob2 = $bob; In functions, I have applied Globally declared variables $Letters = $ArrayCreatedInFunction; and the $Letters functions as that array during the scope of the function.

Ooo Ëxçã¿îbúr ooO"Information Is Not Knowledge." ~Albert Einstein

Share this post

Link to post
Share on other sites


why do you want to check for 0. You can check everything else.

Dim $array[1] = ['check']
If IsArray($array) Then
    _ArrayAdd($array, '1')
    _ArrayAdd($array, '2')
    _ArrayAdd($array, '3')
    _ArrayAdd($array, '4')
    _ArrayDisplay($array, "Array")

If $array[0] <> "check" Or UBound($array) = 1 Then
    MsgBox(0, "error", "error nothing added")
    MsgBox(0, "Added", UBound($array)-1)

So long,


Scripts & functions Organize Includes Let Scite organize the include files

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

LoginWrapper Secure scripts by adding a query (authentication)

_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)

Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.

MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times

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  

  • Create New...