From my understanding we can't put this in a coroutine, because:
wl.Game().map.valuable_fields
blocks the lua script, as long as it is calculating, and these calculations eat up all available cpu.
With this
run(function() fields = wl.Game().map.valuable_fields end)
it runs in a coroutine, but the game stalls until the calculations are done.
It isn't a real coroutine either, because we need to call
coroutine.yield()
from within the coroutine to pause it. But we can't since the c++ part blocks the script.
« Back to merge proposal
From my understanding we can't put this in a coroutine, because:
wl.Game( ).map.valuable_ fields
blocks the lua script, as long as it is calculating, and these
calculations eat up all available cpu.
With this
run(function() ).map.valuable_ fields
fields = wl.Game(
end)
it runs in a coroutine, but the game stalls until the calculations are
done.
It isn't a real coroutine either, because we need to call
coroutine.yield()
from within the coroutine to pause it. But we can't since the c++ part
blocks the script.