Jump to content
Sign in to follow this  
jaberwacky

What's wrong with this?

Recommended Posts

jaberwacky

#Include <Array.au3>

Local $Array[ 3 ] = [1,2,3]

_ArrayToString(_ArraySort($Array))

C:\Documents and Settings\Administrator\Desktop\afrarg.au3(5,34) : ERROR: _ArrayToString() called with exp<b></b>ression on Const ByRef-param(s).
_ArrayToString(_ArraySort($Array))
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
C:\Program Files\AutoIt3\Include\Array.au3(1243,81) : REF: definition of _ArrayToString().
Func _ArrayToString(Const ByRef $avArray, $sDelim = "|", $iStart = 0, $iEnd = 0)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^

Share this post


Link to post
Share on other sites
Valuater

On success, _ArraySort() returns 1. Basically you are stating ArrayToString(1)

Maybe...

#include <Array.au3>
Local $Array[4] = [1, 4, 2, 3]
_ArraySort($Array)
$string = _ArrayToString($Array, ",")
MsgBox(4096, "String", $string)

8)


NEWHeader1.png

Share this post


Link to post
Share on other sites
jaberwacky

On success, _ArraySort() returns 1. Basically you are stating ArrayToString(1)

Maybe...

#include <Array.au3>
Local $Array[4] = [1, 4, 2, 3]
_ArraySort($Array)
$string = _ArrayToString($Array, ",")
MsgBox(4096, "String", $string)

8)

Oh DUH! Thanks Valuator...

Any reason why it returns a 1 and not a sorted array?

Oh because the array is passed ByRef and therefore it sorts the array in place?

Edited by jaberwocky6669

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  

×