Gar Posted April 24, 2011 Share Posted April 24, 2011 So I have a bit of complex code that runs normally for awhile, then, at some point, the array I'm using blanks to nothing. (just "" and not an array) I have very few interactions with the array, so I can't figure out why this is happening. I have some _ArrayPops, but I put two 'null's at [0] and [1] and stop the pops if they are 'null'... but it's still happening. I also have some ByRefs passes. Does anyone know if there's a common bug or something that can blank an array? Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted April 24, 2011 Moderators Share Posted April 24, 2011 Gar,Arrays usually behave unless you remove all the elements (which you say you do not) or you redeclare them a a simple variable. If you posted your code we might be able to offer more pertinent advice. GEOSoft - look away now! When you post code please use Code tags. Put [autoit] before and [/autoit] after your posted code.M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
Gar Posted April 24, 2011 Author Share Posted April 24, 2011 Gar, Arrays usually behave unless you remove all the elements (which you say you do not) or you redeclare them a a simple variable. If you posted your code we might be able to offer more pertinent advice. GEOSoft - look away now! When you post code please use Code tags. Put [autoit] before and [/autoit] after your posted code. M23 Cool thanks for the tag info, am sort of newbie here. This area MUST be the problem but I can't discern exactly how. $Array = _ArrayCreate("Null", "Null") ;some other function adds elements to the array, then: For $count = UBound($Array)-1 to 2 step -1 If $Array[$count] = "Null" Then Return EndIf $event = _ArrayPop($Array) Next This eventually results in the array being popped to zero... but shouldn't this work? Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted April 24, 2011 Moderators Share Posted April 24, 2011 Gar,- 1. Why use the UDF function when you can create arrays by merely declaring them? - 2. Return is for exiting functions - you need ExitLoop to escape from the For...Next loop. - 3. If you stop your loop at 2 you will never check the Null values - remember that arrays start at element [0]. This should work for you: #include <Array.au3> Global $Array[2] = ["", ""] ;some other function adds elements to the array, then: For $count = UBound($Array) - 1 To 1 Step -1 If $Array[$count] = "" Then ExitLoop EndIf $event = _ArrayPop($Array) Next _ArrayDisplay($Array)All clear? M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
Gar Posted April 24, 2011 Author Share Posted April 24, 2011 Ah, thank you! A couple things I never knew Thanks for the info, it worked! Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now