Type Alias lua_Continuation

Source
pub type lua_Continuation = extern "C-unwind" fn(L: *mut lua_State, status: lua_Status) -> c_int;
Expand description

The type of a continuation function that can be called from Luau.

When a C function yields, either by yielding directly or by calling a function that yields, it’s continuation will be run when the coroutine is resumed.

The following Luau and C code segments are equivalent:

local function foo()
    print("foo")
    coroutine.yield()
    print("bar")
end
int foo(lua_State* L) {
    printf("foo\n");
    return lua_yield(L, 0);
}

int foo_cont(lua_State* L, int status) {
    printf("bar\n");
    return 0;
}