Yielding from a coroutine seems to clear a local table
Mantenedores costumam responder em até 2 dias
Ninguém assumiu esta issue ainda.
Avaliação
- Dificuldade
- 4/5
- Tempo estimado
- 3-5 dias
- Facilidade para iniciantes
- 35/100
Direção de pesquisa
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.
Escrita pelo modelo de indexação a partir do texto da issue.
Descrição
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
- Linguagem predominante
- C++
- Estrelas
- 329
- Forks
- 47
- Merge médio
- 6d 10h
- PRs com merge (30d)
- 14
Preparar o ambiente
Este projeto não oferece contêiner de desenvolvimento, Dockerfile nem guia de contribuição, então a configuração fica por sua conta: comece pelo README e veja nosso guia da primeira contribuição para os passos gerais.
Primeiros passos
- Leia a issue inteira e depois o guia de contribuição do projeto.
- Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
- Faça um fork do repositório e trabalhe em uma branch.
- Abra um pull request que referencie o número da issue.
Mais de cortex-command-community/Cortex-Command-Community-Project
-
bug
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 76/100
cortex-command-community/Cortex-Command-Community-Project#315 ·
Mantenedores costumam responder em até 2 dias
-
enhancement
Dificuldade 1/5 Menos de uma hora Facilidade para iniciantes 87/100
cortex-command-community/Cortex-Command-Community-Project#301 ·
Mantenedores costumam responder em até 2 dias
-
bug
Dificuldade 3/5 1-2 dias Facilidade para iniciantes 50/100
cortex-command-community/Cortex-Command-Community-Project#316 ·
Mantenedores costumam responder em até 2 dias
-
bug
Dificuldade 3/5 1-2 dias Facilidade para iniciantes 57/100
cortex-command-community/Cortex-Command-Community-Project#314 ·
Mantenedores costumam responder em até 2 dias
-
bug
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 55/100
cortex-command-community/Cortex-Command-Community-Project#313 ·
Mantenedores costumam responder em até 2 dias
Todas as issues de cortex-command-community/Cortex-Command-Community-Project
Issues semelhantes
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 72/100
elf-alchemist/elfbsp#113 ·
Mantenedores costumam responder em até 1 dia
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 75/100
patrick-hudson/put.gd-desktop#979 · 1 comentário ·
Mantenedores costumam responder em até 1 dia
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 76/100
Dao-AILab/flash-attention#3097 ·
Mantenedores costumam responder em até 3 dias
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 85/100
Niko1221/Strata#4779 · 2 comentários ·
Mantenedores costumam responder em até 3 dias
-
tech-debt
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 82/100
prestonbrown/helixscreen#1990 ·
Mantenedores costumam responder em até 1 dia