Skip to content
User Avatar
#1146
Auto-translated
Well, in general, any element can be an array (and not only that); accessing it is simple:
array[index1][index2]
mass[index1][index2][index3]

but array[index1], mass[index1], and mass[index1][index2] must be arrays, otherwise, there will be an error.

Assignment is done step by step, if it's the first time:
array = {}
array[ind1] = {}
array[ind1][ind2] = ""

concatenating indices looks like concatenating strings:
hero1 = 'Brem' -- implicit variables obtained as a result of something
hero2 = 'Grok'

array[hero1..hero2] = element

but, if you don't access array[hero1..hero2], but array[hero2..hero1], it will return nil. Therefore, it's better to COMPARE strings before assigning.
if hero1 >= hero2 then
array[hero1..hero2] = element
else
array[hero2..hero1] = element
end
The same applies when accessing the array.
Карты для Героев Меча и Магии 5
Одиночные: Завеса срывается, Посол, Последний рывок, Эхо Пустоты
Кампания: Империя Единорога

Существа NCF
Орден Порядка: 1
Нейтралы: 1 2 3 4

Statistics

Welcome our newest member: wayal