Like coroutine.create , the coroutine.wrap purpose in addition brings a coroutine, but instead of going back the coroutine itself, it return a function that, when called, resumes the coroutine. application . coroutine.wrap comes back most of the standards returned by coroutine.resume , except the first one (the boolean error signal). Unlike coroutine.resume , coroutine.wrap cannot capture errors; any error was propagated for the caller.
This section talks of the C API for Lua, which, the group of C applications accessible to the number program to speak with Lua. All API applications and associated types and constants is announced inside header file lua.h .
Even if we make use of the name “function”, any center inside the API is provided as a macro instead. All such macros make use of all of their arguments exactly when (with the exception of initial debate, which will be constantly a Lua condition), and thus dont create any hidden side-effects.
As in most C libraries, the Lua API features dont check her arguments for substance or persistence. However, you’ll transform this actions by putting together Lua with an effective description for any macro luai_apicheck , in file luaconf.h .
3.1 The Pile
Lua uses an online pile to successfully pass values back and forth from C www.datingmentor.org/cs/popularni-seznamka/. Each take into account this pile shows a Lua value (nil, wide variety, sequence, etc.).
Each time Lua phone calls C, the also known as function gets a bunch, and that’s separate of earlier piles as well as stacks of C performance which can be still effective. This heap initially have any arguments on the C function which is where in actuality the C features pushes the brings about feel gone back to the person (discover lua_CFunction ).
For benefits, more question procedures from inside the API dont follow a strict heap control. Alternatively, they can relate to any factor in the bunch with a directory: an optimistic list signifies an outright bunch place (beginning at 1); a poor index symbolizes an offset in accordance with the top of the bunch.