[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Clone a Lua State
- From: Russ Webb <Russell.Webb@...>
- Date: Thu, 14 Feb 2002 16:42:41 -0800
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 <firstname.lastname@example.org>
> Reply-To: email@example.com
> Date: Tue, 12 Feb 2002 18:46:20 +0100
> To: Multiple recipients of list <firstname.lastname@example.org>
> 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
> Do You Yahoo!?
> Get your free @yahoo.com address at http://mail.yahoo.com