Skip to content
User Avatar
#1142
Auto-translated
Dyrman
Is it possible to specify a variable function name in startThread (it doesn't like quotes)? For example:

for i,e in mass
startThread(oops_..i.._F)
end;
The above is just an example)
You can create an array of functions:
array = {
[1] = function()
end, -- semicolons should be placed inside the array, following tradition :)
[2] = function() -- they are there for another purpose
end,
}
and access it like this: array[1](arg1, arg2)

or
function oops_1_F()end
function oops_2_F()end

for i=1,2 do
startThread(parse('oops_'..i..'_F()'))
end
Added 4 minutes later
[/U]
Excellent. I'll try it out. Thank you.
But they cannot be concatenated or replaced with variables. Only in the first case is this possible.
Карты для Героев Меча и Магии 5
Одиночные: Завеса срывается, Посол, Последний рывок, Эхо Пустоты
Кампания: Империя Единорога

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

Statistics

Welcome our newest member: artem