AwesomeIt/includes/_Subarray.au3

31 lines
1 KiB
AutoIt
Raw Normal View History

2015-05-19 12:39:34 +02:00
#cs ----------------------------------------------------------------------------
AutoIt Version: 3.3.12.0
Author: Sqozz
Script Function:
Template AutoIt script.
#ce ----------------------------------------------------------------------------
; Inserts an array into an array
; Returns the position, where the new array inside the parent array is living
; For Example: use _ArrayGetFromArray($mainArray, _ArrayAddToArray($mainArray, $arrayToAdd)) to get $arrayToAdd
Func _ArrayAddToArray(ByRef $mainArray, $arrayToAdd)
$indexOfNew = _ArrayAdd($mainArray, "") ; Create a new entry in the desired array
$mainArray[$indexOfNew] = $arrayToAdd
Return $indexOfNew
EndFunc
Func _ArrayGetFromArray($mainArray, $indexToGet)
$subArray = $mainArray[$indexToGet]
Return $subArray
EndFunc
Func _InsertArrayToArray(ByRef $mainArray, $arrayToAdd, $indexToInsert, $secondIndex = Null )
If $secondIndex <> Null Then
$mainArray[$indexToInsert][$secondIndex] = $arrayToAdd
Else
$mainArray[$indexToInsert] = $arrayToAdd
EndIf
EndFunc