lua-users home
lua-l archive

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


I wouldn't suggest #2. There's a lot of types of objects referenced by
the lua_State, with some moderately complicated connectivity. It's
certainly possible, but it's a pain in the tuckus.

If you want to serialize *everything* in the Lua state, the easiest
approach is a Lua variant called lper. That basically does your #3.
It's unix-specific, though... I'm not sure how much work would be
involved in porting it to win32.

Ben

On Fri, Mar 20, 2009 at 7:10 AM, kathrin_69@gmx.de <kathrin_69@gmx.de> wrote:
> Hi,
>
> I want to save the state of a Lua VM to a file to re-load and restart
> execution later.
>
> Three options come to my mind:
>
> 1. Serializing the global index table of the VM. I even found a library
> called "Pluto" which promises to do this.
>
> 2. Trying to make a deep copy of the lua_State* pointing to a VM and
> save/load the binary data.
>
> 3. Trying to overwrite malloc/free for the Lua.dll, place all memory the VM
> holds in an pre-allocated chunk. Save and re-load that whole chunk. I'm not
> sure If I'm yet experienced (in C/C++) enough to get this done. Probably
> not.
>
>
>
> My Questions are:
>
> 1. Which of that options will work or which one are used and which not?
> 2. Are there any other options I missed?
> 3. Which option is most promising in terms of time and complexity?
> 4. Are there any other helper libraries (beside Pluto) which helps doing one
> of the options?
>
> Thank you!
>
> Regards
> Joerg
>
>