Hi CrazyFlyCat, I use coroutines to process a chunk of the mplog, and when the mission exits process what's left in the mplog/asynlog files.
function LuaExportStop()
stats_engine.complete_processing()
stats_engine.destroy()
end
function update_stats(t)
while true do
stats_engine.process_buffer()
coroutine.yield()
end
end
function CoroutineResume(index, tCurrent)
coroutine.resume(Coroutines[index], tCurrent)
return coroutine.status(Coroutines[index]) ~= "dead"
end
CoroutineIndex = CoroutineIndex + 1
Coroutines[CoroutineIndex] = coroutine.create(update_stats)
LoCreateCoroutineActivity(CoroutineIndex, 1.0, 60.0)