MyTetra Share
Делитесь знаниями!
Добавление массива в качестве элемента массива / Dict / Array
Время создания: 04.06.2017 09:10
Раздел: AutoHotkey - Arrays
Запись: xintrea/mytetra_db_mcold/master/base/1496556607lmliow6olg/text.html на raw.githubusercontent.com

Array := Object() ; Создаем массив

Dict1 := {id : 1, type : "left", name : "Harry"}

Dict2 := {id : 2, type : "right", name : "Andy"}

Dict3 := {id : 2, type : "text", name : "Buddy"}

Array.Insert(Dict1) ; вставляем словарь как элемент массива

Array.Insert(Dict2)

Array.Insert(Dict3)


;MsgBox % Array[1].type ; выводим тип 1-ого элемента массива



for i in Array ; цикл вывода типов элементов массива

{

; MsgBox % Array[i].type ; вывод типа элемента массива

if % Array[i].type = "left"

{

;MsgBox %A_Index% is left

}

if % Array[i].type = "right"

{

;MsgBox %A_Index% is right

}

if % Array[i].type = "text"

{

;MsgBox %A_Index% is text

}

}


num := 3


Loop, %num%

{

Dict := {id : A_Index} ; если использовать %var% то не работает

Array.Insert(Dict)

}

MsgBox Good

Так же в этом разделе:
 
MyTetra Share v.0.59
Яндекс индекс цитирования