[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: 5.3w2 Continuation changes: Tutorial?
- From: Philipp Janda <siffiejoe@...>
- Date: Mon, 30 Jun 2014 21:28:59 +0200
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,
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.