[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Clone a Lua State
- From: Jean Claude Morlier <morlier@...>
- Date: Fri, 15 Feb 2002 12:23:39 -0500
Thank's, I have done with this way.
But I would change to use another state for security on freeing memory.
And don't worry about GC operation.
Russ Webb a écrit :
> I do a similar thing by using the globals table. I load all the
> functionality I want and then save a reference in C to the globals. then I
> install a empty globals table (making the old one inaccessible from Lua) and
> do a *shallow* copy of all the entries from the saved state to the new
> globals. Then after running scripts that could corrupt the state I reset by
> installing a new globals table and doing a shallow copy to it.
> Doesn't solve the general problem of course but it works for all non-table
> globals. And is faster than recreating the original state.
> > From: Ignacio Castaño <email@example.com>
> > Reply-To: firstname.lastname@example.org
> > Date: Tue, 12 Feb 2002 18:46:20 +0100
> > To: Multiple recipients of list <email@example.com>
> > Subject: Re: Clone a Lua State
> > Jean Claude Morlier wrote:
> >> I'm interesting by the way that you resolve it.
> >> I would appreciate that you tell me how. You can contact me in a private
> >> thread If you want.
> >> I have also a do it in a different way. But I have some difficulties to
> >> propagate function and tag to cloned state.
> > I just kept all the modifications in a table so that after running the
> > script I could clean the results with ease (table=nil). I know it's not
> > completely safe, but it was ok for me.
> > Ignacio Castaño
> > firstname.lastname@example.org
> > _________________________________________________________
> > Do You Yahoo!?
> > Get your free @yahoo.com address at http://mail.yahoo.com