>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.
-- 
https://code.launchpad.net/~widelands-dev/widelands/bug-1810062-territorial-calculations/+merge/361366
Your team Widelands Developers is subscribed to branch 
lp:~widelands-dev/widelands/bug-1810062-territorial-calculations.

_______________________________________________
Mailing list: https://launchpad.net/~widelands-dev
Post to     : widelands-dev@lists.launchpad.net
Unsubscribe : https://launchpad.net/~widelands-dev
More help   : https://help.launchpad.net/ListHelp

Reply via email to