lua-users home
lua-l archive

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


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!