[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: How to swap coroutine ?
- From: Tony Finch <dot@...>
- Date: Tue, 13 Sep 2011 09:41:56 +0100
Gaspard Bucher <email@example.com> wrote:
> On Tue, Sep 13, 2011 at 8:53 AM, Graham Wakefield <firstname.lastname@example.org>wrote:
> > Exactly. Start your script with lua_resume() rather than lua_call().
> This is a good idea if you run a custom executable, which I don't (I want to
> use plain Lua).
You can do the equivalent in plain Lua if you have a wrapper script that
loads the user's script and calls coroutine.resume on it.
> Technically, what I want to do doesn't seem impossible (it's some kind
> of resumable goto) and it would enable to completely hide the scheduling
Yes, symmetric coroutines are possible but Lua has asymmetric coroutines.
There is a rationale in this paper:
f.anthony.n.finch <email@example.com> http://dotat.at/
Hebrides, Southeast Bailey: Northwesterly 4, increasing 5 to 7, perhaps gale 8
later. Very rough, occasionally high later. Rain. Mainly moderate.