Jump to content

How To Extract The Parameter's Name Given To A Func?


Recommended Posts

Hi all,

I have created 2 arrays and want to sort them. I have created a function which receives the array and sort it. Its working well, but I want to be able to print using a msgbox that the array is sorted. I would like to do it inside the function. How can I get the name of the parameter introduced to the func?

#include <array.au3>

Dim $myArray1[3]
Dim $myArray2[3]

$myArray1[0]="98"
$myArray1[1]="67"
$myArray1[2]="12"

$myArray2[0]="44"
$myArray2[1]="22"
$myArray2[2]="11"

sort ($myArray1)
sort ($myArray2)

Func sort ($array)
    _ArraySort ($array,0,0,0)
    msgbox (0,"","The array: " & $array & " was sorted.")
EndFunc
Edited by BlueScreen
Link to comment
Share on other sites

You can't (as far as I know).

1 work-around solution:

#include <array.au3>

Dim $myArray1[3]
Dim $myArray2[3]

$myArray1[0]="98"
$myArray1[1]="67"
$myArray1[2]="12"

$myArray2[0]="44"
$myArray2[1]="22"
$myArray2[2]="11"

sort ($myArray1, "$myArray1")
sort ($myArray2, "$myArray2")

Func sort ($array, $name)
    _ArraySort ($array,0,0,0)
    msgbox (0,"","The array: " & $name & " was sorted.")
EndFunc

#)

Link to comment
Share on other sites

Hmmm... I noticed another thread discussing the same thing:

http://www.autoitscript.com/forum/index.php?showtopic=24294

Didn't seem to get any easy-to-use solution though.

#)

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