lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]

Lothar Scholz wrote:
Does LUA switch the C stack in any way when using coroutines? I'm 99%
sure the answer is no because it can't be done with ANSI C.
No. The luavm in general does not use the C stack for much. The exception is coroutines (where there is a recursive call to the vm for resume, and a return for yield) and C calls (well, obviously, you have to call the C function with some C stack space).

As you mentioned, it is all ANSI C, no raw manipulation of the C stack is involved.

For more information, see The implementation of Lua 5.0, by R. Ierusalimschy, L. H. de Figueiredo, W. Celes:
Page 11 talks about exactly that.