[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: cloning lua state
- From: Philipp Kraus <philipp.kraus@...>
- Date: Tue, 7 Oct 2014 12:56:10 +0200
Hello,
thanks a lot of this information. In my case I would like to copy the current script only, all internal states / variables can be resetted. I have got a Lua script, which is run by the interpreter and I don’t want to store a copy of the „plain text“ script, so I would like to copy the state with the loaded script and all other things can be cleared
Can I do this with the C API?
Thanks
Phil
Am 06.10.2014 um 20:29 schrieb Tim Hill <drtimhill@gmail.com>:
> Well there is no Lua API to do this and a full clone would be immensely difficult. You would have to deep copy the registry, and in the process would hit things that are not easily copied such as user data and threads. So in practice this could only work if the source Lua state had no userdata and no threads. You would also have to handle issues with loaded libraries and special case some of the standard libraries.
>
> --Tim
>
>> On Oct 6, 2014, at 9:25 AM, Philipp Kraus <philipp.kraus@tu-clausthal.de> wrote:
>>
>> Hello,
>>
>> I have encapsulate the lua_state in a C++ class and I can run my Lua scripts well, but I would like to create a Copy-Ctor which creates a fill in depended clone of the current lua_state.
>> How can I clone the current lua_state with a full deep-copy? Does there exists a C API function, how can I do this?
>>
>> Thanks a lot
>>
>> Phil
>