Auto-translated
Is there a script that determines whether a given function is currently running or not? (without using a flag within the function itself)
For example, consider this:As a result, several Func functions may start, even though the previous one might not have finished.
for i=1,100 do
startThread(Func);
end
local threads = {}
local startExec = function(func)
local threads = threads
errorHook(function()
%threads[%func] = nil
end)
threads[func] = 1
func()
threads[func] = nil
end
function startThreadOnce(func)
if not %threads[func] then
startThread(%startExec, func)
end
end
function isFunctionRunning(func)
return %threads[func]
end
In this example, startThreadOnce starts the function only if it is not currently running. isFunctionRunning checks whether the function is currently running.
Карты для Героев Меча и Магии 5
Одиночные: Завеса срывается, Посол, Последний рывок, Эхо Пустоты
Кампания: Империя Единорога
Существа NCF
Орден Порядка: 1
Нейтралы: 1 2 3 4
Одиночные: Завеса срывается, Посол, Последний рывок, Эхо Пустоты
Кампания: Империя Единорога
Существа NCF
Орден Порядка: 1
Нейтралы: 1 2 3 4