JohnOne Posted September 30, 2014 Share Posted September 30, 2014 Just wondering if this is a bug. Local $a1[2] = [1,2] Local $a2[2] = [1,2] $cw = ConsoleWrite($a1 & @CRLF & $a2 & @CRLF & "some text" & @CRLF) ConsoleWrite("error and return = " & @error & " " & $cw & @LF) Output.. >Running:(3.3.12.0)blah... --> Press Ctrl+Alt+F5 to Restart or Ctrl+Break to Stop error and return = 0 0 +>20:59:36 AutoIt3.exe ended.rc:0 >Exit code: 0 Time: 0.536 I understand an array might not have a value to display, there are other values in the expression that do. AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
JohnOne Posted September 30, 2014 Author Share Posted September 30, 2014 Compared to this, makes me believe it to be some sort of bug. Local $a1[2] = [1,2] Local $a2[3] = [1,2,3] $cw = ConsoleWrite(null & @CRLF & $a2 & @CRLF & "some text" & @CRLF) ConsoleWrite("error and return = " & @error & " " & $cw & @LF) AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted September 30, 2014 Moderators Share Posted September 30, 2014 JohnOne,This very thing was discussed a few months ago amongst the MVPs and there was a sharp difference of opinion between those who believe that as arrays have no String return it is quite reasonable that ConsoleWrite should fail when asked to concatenate one with a string, and those who felt that the array should just be counted as an empty string and the remainder of the parameters displayed.This was the code I posted to show what happens:#include <array.au3> Global $a[1] = ["Test1"], $s = "Test2" ; Attempt to concatenate array and string - you get an array Local $x = $a & " / " & $s & " end" & @CRLF ; This CW fails completely as the argument is not a string ConsoleWrite($x & " - " & VarGetType($x) & @CRLF) ; But the array remains untouched - you can see the array type remains _ArrayDisplay($x, VarGetType($x)) ; Reversing the order of concatenation gives a string and just ignores the array Local $y = $s & " / " & $a & " end" & @CRLF ConsoleWrite($y & VarGetType($y) & @CRLF)The discussion ended without a firm decision being taken as to what should be the "correct" result - and as one who supported the first of the options I outlined above I am quite happy to retain the status quo. 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...
JohnOne Posted September 30, 2014 Author Share Posted September 30, 2014 In the example above, $a2 does appear to be treated as an empty string, consolewrite only fails when an array is first to be parsed. That's what made me believe it to be a bug. Local $a1[2] = [1,2] Local $a2[3] = [1,2,3] Local $a3[4] = [1,2,3,4] Local $anythingelse $cw = ConsoleWrite($a1 & @CRLF & $a2 & @CRLF & $a3 & @CRLF & "some text" & @CRLF) ConsoleWrite("error and return = " & @error & " " & $cw & @LF) $cw = ConsoleWrite($anythingelse & $a1 & @CRLF & $a2 & @CRLF & $a3 & @CRLF & "some text" & @CRLF) ConsoleWrite("error and return = " & @error & " " & $cw & @LF) AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. 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