Imagine you have a C program like this:
#include <fancylib.h>
int main() {
for (int i = 0; i < 10; i++) {
printf("val[%d] = %d\n", i, fancylib_calculate(i));
}
fancylib_cleanup();
}
Now imagine that internally, fancylib uses Lua. So fancylib_calculate() calls lua_call().Now imagine that the Lua function run by fancylib decides to use continuations. When you call fancylib_calculate(0), it creates a continuation. And when you call fancylib_calculate(1), it decides to call the continuation.
If you restore the entire C stack to resume the Lua continuation, it will reset the loop in main() to i=0! Your program might end up printing val[0] over and over, in an infinite loop. This would be extremely surprising to you as the author of main(), because you were just trying to write a normal old for() loop. The Lua continuation should just restore the Lua-related stack, not the stack of the functions calling Lua!