Mateocedillo Posted December 5, 2022 Share Posted December 5, 2022 (edited) Cheers, I have a plan to develop something but there is a problem. I want to develop a load function, this function will generate two arrays with totally different values and the problem is how AutoIT could return these two different arrays in one function. Here's an example of what I'm trying to say: local $aArray1, $aArray2 $aArray1, $aArray2 = _Test_func() Func _Test_func() local $aArrayA = [1, 2, 3] local $aArrayB = [4, 5, 6] return $aArrayA, $aArrayB EndFunc Edited December 5, 2022 by Mateocedillo Link to comment Share on other sites More sharing options...
ahmet Posted December 5, 2022 Share Posted December 5, 2022 Look for ByRef. spudw2k 1 Link to comment Share on other sites More sharing options...
Subz Posted December 5, 2022 Share Posted December 5, 2022 Why not just use global array, maybe I'm missing something: Global $g_aArray1, $g_aArray2 _Test_func() Func _Test_func() $g_aArray1 = [1, 2, 3] $g_aArray2 = [4, 5, 6] EndFunc Link to comment Share on other sites More sharing options...
abberration Posted December 5, 2022 Share Posted December 5, 2022 It might take some time to grasp this idea, but you could return as many 2d arrays you want in a single 3d array. I can give you an example if you are interested. Easy MP3 | Software Installer | Password Manager Link to comment Share on other sites More sharing options...
Danp2 Posted December 5, 2022 Share Posted December 5, 2022 A JSON object or string can contain multiple values / arrays. Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
Zedna Posted December 5, 2022 Share Posted December 5, 2022 (edited) I think that global array or ByRef parameters would be the best (and the most simple) solution. But here is another quite simple example/solution using (1D) array of (two) arrays: #include <Array.au3> #include <Debug.au3> local $aArray0, $aArray1, $aArray2 $aArray0 = _Test_func() $aArray1 = $aArray0[0] $aArray2 = $aArray0[1] _DebugArrayDisplay($aArray1) _DebugArrayDisplay($aArray2) Func _Test_func() Local $aArrayRet[2] local $aArrayA = [1, 2, 3] local $aArrayB = [4, 5, 6] $aArrayRet[0] = $aArrayA $aArrayRet[1] = $aArrayB return $aArrayRet EndFunc Edited December 5, 2022 by Zedna pixelsearch 1 Resources UDF ResourcesEx UDF AutoIt Forum Search 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