Jump to content

Efficient function/way to delete an entire array?


Recommended Posts

AutoIt makes it easy. Simply reassigning a value to the array, or allowing it to go out of scope is enough to destroy the array. (Yes, nested arrays would be properly destroyed as well)

So basically, if you have

Global $avArray[100000]

and assign values to it, doing something like

$avArray = 0

is enough to delete the entire array.

Edited by -Ultima-

[ WinINet.au3 | Array.au3 (Optimized) | _UnixTimeParse() ]

Link to comment
Share on other sites

To empty an array you can use Dim. eg; Dim $Arr[100]

#include <Array.au3>

Dim $Arr[101]; To create an array

; fill an array with data
For $i = 0 To UBound($Arr) -1
    $Arr[$i] = $i
Next    

_ArrayDisplay($Arr, "Contents of $Arr array")

Dim $Arr[101]; To create an array

_ArrayDisplay($Arr, "Dim $Arr[101]")

$Arr = 0 ; To destroy array

MsgBox(0, "IsArray($Arr)", IsArray($Arr) <> 0)

Cheers

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