Jump to content

how to make func return array?


0x90h
 Share

Recommended Posts

Func PeopleOnline($control)
Dim $aPeople[2]
$aData = StringSplit(ControlGetText($hWnd,'',$control),@CRLF) ; $aData[5]="Online N of N", N < 10
$aPeople[0] = StringMid($aData[5],8,1) ; now
$aPeople[1] = StringMid($aData[5],13,1) ; total
Return $aPeople
EndFunc

$Online = PeopleOnline("Label9")

this is how my function looks like, and how i would like to use it. the problem is my func does not return array of data to my variable.

would you be so nice to give me a hand on this?

regards

0x90 nop

Link to comment
Share on other sites

I think this would work:

Func PeopleOnline($control)
Dim $aPeople[2]
$aData = StringSplit(ControlGetText($hWnd,'',$control),@CRLF) ; $aData[5]="Online N of N", N < 10
$aPeople[1] = StringMid($aData[5],8,1) ; now
$aPeople[2] = StringMid($aData[5],13,1) ; total
Return $aPeople[0]
EndFunc

$Online = PeopleOnline("Label9")

I'm not positive.

Link to comment
Share on other sites

  • Developers

Works for me :

#include<array.au3>
$Online = PeopleOnline("Label9")
_ArrayDisplay($Online)
;
;
Func PeopleOnline($control)
    Local $aPeople[2]
    $aPeople[0] = 1
    $aPeople[1] = 2
    Return $aPeople
EndFunc  ;==>PeopleOnline

:)

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

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