[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Making serialised coroutines patchable
- From: Jonathan Shaw <Jonathan.Shaw@...>
- Date: Wed, 10 Jan 2007 11:20:34 +0000
Hello!
I'm making extensive use of coroutines in the project that I'm working on, and I would like to be able to achieve two goals when it comes to serialisation: to be able to serialise the whole Lua state, including the coroutines and their call stacks and local variables, and to also be able to patch the scripts and have "old" saves work with the patched scripts.
I'm using Pluto (http://lua-users.org/wiki/PlutoLibrary) to serialise the Lua state and by necessity this saves out the function definitions as well as everything else (to ensure that when the coroutines are resumed they continue from the same place in the same function they were in when they were serialised). However, this means that it's then impossible to patch the scripts, because if you load a Lua state serialised in this way then all of the patched functions will be overwritten by the unpatched functions that were saved earlier. But if I tried to change Pluto so that it doesn't save out function definitions then it won't necessarily resume the coroutines from the correct places, as the patched functions will have different line numbering in them.
Is there a way around this, or am I trying to achieve the impossible here? Thanks in advance for any advice!
Jonathan