Like coroutine.create , the coroutine.wrap function in addition brings a coroutine, but instead of going back the coroutine alone, they return a function that, whenever called, resumes the coroutine. application . coroutine.wrap profits most of the prices came back by coroutine.resume , except the very first one (the boolean mistake signal). Unlike coroutine.resume , coroutine.wrap doesn’t capture problems; any mistake is propagated toward person.
This part describes the C API for Lua, this is certainly, the set of C applications open to the host program to speak with Lua. All API features and relevant types and constants were stated in header document lua.h .
Even when we make use of the phase “function”, any center during the API is likely to be given as a macro instead. All this type of macros make use of every one of their arguments just when (aside from one discussion, that’s always a Lua condition), and therefore try not to produce any undetectable side effects.
Like in most C libraries, the Lua API features try not to check their arguments for validity or reliability. But possible change this behavior by producing Lua with a proper description for all the macro luai_apicheck , in document luaconf.h .
3.1 The Pile
Lua uses an online stack to pass through beliefs back and forth C. Each factor in this stack shows a Lua value (nil, quantity, sequence, etc.).
Whenever Lua calls C, the called features becomes another pile, which can be separate of past piles and of stacks of C functionality which can be nonetheless productive. …