Yielding from a coroutine seems to clear a local table
Les mainteneurs répondent en général sous 2 jours
Personne n'a encore pris cette issue.
Évaluation
- Difficulté
- 4/5
- Temps estimé
- 3-5 jours
- Accessibilité débutants
- 35/100
Piste de recherche
Start by reproducing the coroutine behavior with the Lua snippet in the issue, then inspect how the game embeds and resumes Lua coroutines. Compare the local table and other locals across the yield, and trace the resulting behavior to the reported mod error at MeleeHumanBehaviors.lua:1201. Done means explaining or fixing why PathDump becomes empty and confirming the reproduction no longer produces the reported error.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Description
Describe the bug
I expected 5 to be printed a second time here, rather than it becoming 0.
I can't explain the fact that a and #b are still the correct value after the yield, though.
PRINT: 1. #PathDump is:
PRINT: 5
PRINT: 2. #PathDump is:
PRINT: 0
PRINT: a is:
PRINT: 1
PRINT: #b is:
PRINT: 1
since I can't think of a normal way in Lua for coroutine.yield() to alter the local PathDump
-- no waypoint list, create one in several small steps to reduce lag
local PathDump = {}
if Owner.MOMoveTarget and MovableMan:ValidMO(Owner.MOMoveTarget) then
Owner:DrawWaypoints(false)
-- copy the MovePath to a temporary table so we can yield safely while working on the path
for WptPos in Owner.MovePath do
print("Inserting WptPos:")
print(WptPos)
table.insert(PathDump, WptPos)
end
-- clear the path here so the graphical representation does not flicker on and off as much
Owner:ClearMovePath()
Owner:AddToMovePathEnd(Owner.MOMoveTarget.Pos)
else
coroutine.yield() -- wait until next frame
-- copy the MovePath to a temporary table so we can yield safely while working on the path
for WptPos in Owner.MovePath do
table.insert(PathDump, WptPos)
end
end
local a = 1
local b = {"c"}
print("1. #PathDump is:")
print(#PathDump)
coroutine.yield() -- wait until next frame
print("2. #PathDump is:")
print(#PathDump)
print("a is:")
print(a)
print("#b is:")
print(#b)
I am 99% sure the mod didn't have this issue in pre5, as my mod updater script would've noticed this error in the log back then, caused by PathDump being empty:
BoS Initiate GoToWpt error:
Mods/bos.rte/Actors/Soldiers/MeleeHumanBehaviors.lua:1201: attempt to index field 'Pos' (a nil value)
To Reproduce
- Download bos.rte.zip
- Download Benchmark.rte.zip
- Use this in your Settings.ini to instantly have the issue printed when the game boots:
LaunchIntoActivity = 1
DefaultActivityType = GAScripted
DefaultActivityName = Combat Benchmark
DefaultSceneName = Benchmark
- Langage dominant
- C++
- Étoiles
- 329
- Forks
- 47
- Merge moyen
- 6 j 10 h
- PR mergées (30 j)
- 14
Préparer son environnement
Ce projet ne fournit ni conteneur de développement, ni Dockerfile, ni guide de contribution : l'installation est à votre charge. Commencez par son README, et consultez notre guide de la première contribution pour les étapes générales.
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Autres issues de cortex-command-community/Cortex-Command-Community-Project
-
bug
Difficulté 2/5 1-3 heures Accessibilité débutants 76/100
cortex-command-community/Cortex-Command-Community-Project#315 ·
Les mainteneurs répondent en général sous 2 jours
-
enhancement
Difficulté 1/5 Moins d'une heure Accessibilité débutants 87/100
cortex-command-community/Cortex-Command-Community-Project#301 ·
Les mainteneurs répondent en général sous 2 jours
-
bug
Difficulté 3/5 1-2 jours Accessibilité débutants 50/100
cortex-command-community/Cortex-Command-Community-Project#316 ·
Les mainteneurs répondent en général sous 2 jours
-
bug
Difficulté 3/5 1-2 jours Accessibilité débutants 57/100
cortex-command-community/Cortex-Command-Community-Project#314 ·
Les mainteneurs répondent en général sous 2 jours
-
bug
Difficulté 2/5 1-3 heures Accessibilité débutants 55/100
cortex-command-community/Cortex-Command-Community-Project#313 ·
Les mainteneurs répondent en général sous 2 jours
Toutes les issues de cortex-command-community/Cortex-Command-Community-Project
Issues similaires
-
OMPI 5.0.x CI builds failingOuverte
Difficulté 2/5 1-3 heures Accessibilité débutants 64/100
sandialabs/Fenix#172 ·
-
Difficulté 2/5 1-3 heures Accessibilité débutants 72/100
scp-fs2open/fs2open.github.com#7953 ·
Les mainteneurs répondent en général sous 1 jour
-
Difficulté 2/5 1-3 heures Accessibilité débutants 72/100
SteveMacenski/slam_toolbox#907 ·
-
Difficulté 2/5 1-3 heures Accessibilité débutants 78/100
-
Difficulté 2/5 1-3 heures Accessibilité débutants 78/100
Les mainteneurs répondent en général sous 1 jour