Lua co-routines
问题 I'm trying to get an understanding of how I can use co-routines to "pause" a script and wait until some processing is done before resuming. Perhaps I'm looking at co-routines in the wrong way. But my attempt is structured similar to the example given in this answer. The loop in loop.lua never reaches a second iteration, and hence never reaches the i == 4 condition required to exit the running loop in the C code. If I do not yield in loop.lua , then this code performs as expected. main.cpp