我正在尝试访问 Autoit 中嵌套数组中的值,但我收到超出范围的错误消息。这是我的代码:
Func ThisFunction()
local $one[6] = [1, 2, 3, 4, 5, 6]
local $two[6] = [7, 8, 9, 10, 11, 12]
local $combined[2] = [$one, $two]
For $i = 0 to UBound($combined)-1
$result = SomeFunction ( $combined[$i] )
If $result Then
return $combined[$i][0]
EndIf
Next
EndFunc
有没有办法从嵌套的 $combined 数组中访问/返回特定索引?
编辑:我找到了一个可行的解决方案,我不知道这是否是一个好习惯
For $i = 0 to UBound($combined)-1
$result = SomeFunction ( $combined[$i] )
If $result Then
local $temp = $combined[$i]
If IsArray($temp) Then
return $temp[0]
EndIf
EndIf
Next