LUA_YIELD(3) Library Functions Manual LUA_YIELD(3)

lua_yieldyields a coroutine, function indicator [-?, +?, -]

#include <lua.h>

int
lua_yield(lua_State *L, int nresults);

() yields a coroutine. This function should only be called as the return expression of a C function, as follows:

return lua_yield (L, nresults);

When a C function calls lua_yield in that way, the running coroutine suspends its execution, and the call to lua_resume that started this coroutine returns. The parameter nresults is the number of values from the stack that are passed as results to lua_resume(3).

Roberto Ierusalimschy, Luiz Henrique de Figueiredo, and Waldemar Celes, Lua 5.1 Reference Manual.

The lua_yield() manual page is based on Lua Reference Manual 5.1 and was created by Sergey Bronnikov.

July 18, 2022 Debian