lua-users home
lua-l archive

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


I too have been looking into doing this.  The problem with setjump is that
it isn't maintable across load/save.  If someone saves their game while the
lua interpreter is waiting and then quits and restores later on.  You not
only need to be able to 'pause' the interpreter you also need to be able to
serialize its state.


----- Original Message -----
From: "Peter Wang" <tjaden@alphalink.com.au>
To: "Multiple recipients of list" <lua-l@tecgraf.puc-rio.br>
Sent: Thursday, October 19, 2000 17:48
Subject: Re: Cooperative Multitasking


> Sebby  <beast@interlinx.qc.ca> wrote:
> >
> > Well, that's the main problem. Lua runs it's VM in a recusrive way.
> > Basicly, if you call a Lua, from within a Lua function, the VM will
> > simply call itself recursivly. Now, one solution is to basicly back
> > up the section of the system stack that was used in the task (along
> > with the IP and some other info) and to restore it once the thread is
> > brought back. This is an icky solution since you hav eto go backing
> > up some registers and the system stack of the computer.
>
> Could this be done using `setjmp'?  Some Lisp implementations use it
> to follow objects pointed to by the registers for garbage collection
> purposes.  Backing up the system stack is also surprisingly simple,
> if not "clean".  It might be a workable alternative to making the VM
> run iteratively.
>
> --
> tjaden@psynet.net - http://www.psynet.net/tjaden/
> BANDILE (BAN dyl), n.  The thin red strip one pulls to release a Band-Aid.
> -- Rich Hall, "Sniglets"