Sign in to follow this  
Followers 0
0x90h

how to make func return array?

4 posts in this topic

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

Share this post


Link to post
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.

Share this post


Link to post
Share on other sites

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

:)


Visit the SciTE4AutoIt3 Download page for the latest versions  - Beta files                                How to post scriptsource        Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

yes, it works oO

funny part is i did nothing, just started new autoit script, pasted same script code and it works oO

thanks :)

Edited by 0x90h

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  
Followers 0