lua-users home
lua-l archive

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


True enough. I did plan to have some level of latent functions. But 
for now savegames in my case it wouldn't matter too much. But 
somehow, i fear that even though there requirements aren't there for 
now, the issue might pop up later on.

I'v been playing with the setjmp/longjmp idea this evening. So far it 
looks like it might work. The only problem is copying back the stack 
for as thread when it resumes i can't use functions like memcopy 
since they affect the stack thmeselfs. 

But now the only alternatives so far are either the setjmp approach 
or making the VM iterative. Both of them has issues and limitations.

> True, if serialization isn't a problem, setjump/longjump may be a 
workable
> solution.  However, if you want to implement something like what is 
called a
> 'latent function' in unrealscript for use in your AI the 
serialization
> issues need to be contended with.  This will come up even if you 
don't use
> lua for your save games.  If you don't need this functionality 
you'll be in
> the clear.  Unfortunately for me, I do want this functionality as 
it will
> simplify level scripting greatly.
> 
> Allowing level scripters to write stuff like:
> 
> dosomething()
> waitforevent( "some game event" )
> donextthing()
> 
> would be a big win as far as script complexity goes.
> 
> Kelvin
> 
> ----- Original Message -----
> From: "Sebby " <beast@i...>
> To: "Kelvin McDowell" <kelvin_mcdowell@t...>
> Sent: Thursday, October 19, 2000 18:49
> Subject: Re: Cooperative Multitasking
> 
> 
> > > 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.
> >
> > In my case, this wouldn't really matter. For now, i don't have any
> > plans to use Lua as a "serialization" method for save games. And
> > since the games i work on are mostly sport or platform style 
games,
> > it's probably more efficent to just save out the relevant info
> > (current level, inventory, ...) than save the whole state. The
> > scrupting i want is mostly to allow to externalize some game 
behavior
> > like : UI, special FX management, some AI, string tables, asset
> > management.
> >
> > Sebastien St-Laurent
> > Software Engineer
> > sebby@z...
> >
> >
> >