lua-users home
lua-l archive

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


Gaspard Bucher <gaspard@teti.ch> wrote:
> On Tue, Sep 13, 2011 at 8:53 AM, Graham Wakefield <wakefield@mat.ucsb.edu>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
> stuff.

Yes, symmetric coroutines are possible but Lua has asymmetric coroutines.
There is a rationale in this paper:
http://www.inf.puc-rio.br/~roberto/docs/corosblp.pdf

Tony.
-- 
f.anthony.n.finch  <dot@dotat.at>  http://dotat.at/
Hebrides, Southeast Bailey: Northwesterly 4, increasing 5 to 7, perhaps gale 8
later. Very rough, occasionally high later. Rain. Mainly moderate.