lua-users home
lua-l archive

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


Hi!

Am 30.06.2014 20:04 schröbte Andrew Starks:
I read through the changes in the C API. Beyond the tutorials in PiL, I
made any yield-able C function, in real life.

Is there anyone out there that wants to look at the changes in 5.3w2 and
write up a small tutorial / example?

The goal would be to provide some context for these changes.

Not much has changed since Lua 5.2: The `lua_getctx` function is gone now, and the two values it returned (status and context) are passed to the continuation functions directly. As a consequence continuation functions get a new prototype with two extra parameters. And that's it.

If you look at the implementation of `pcall` in the Lua 5.2 source[1], you will see the `pcallcont` function whose only job is to call `lua_getctx` and pass status (and optionally context) to `finishpcall`. Most C functions using `lua_pcallk` had this structure, so with the new prototypes `pcallcont`-like helper functions become unnecessary.


Thanks!

-Andrew


HTH,
Philipp

  [1]: http://www.lua.org/source/5.2/lbaselib.c.html#luaB_pcall