[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Pluto updated
- From: "Grisha" <grisha@...>
- Date: Fri, 11 Jun 2004 11:52:41 +0400
On the second thought, approach with serializing userdata to Lua string will
not work at all for us. There's equally complex space of C++ objects as you
have with Lua objects, so we need a table of permanents and already
serialized objects as context in userdata's __persist function. This is that
very (void *ud) context passed to the Pluto on persist/unpersist call, and
we need it in both save and load of userdata.
The smallest change is to pass chunk_reader/writer and (void *ud) to
__persist metamethod and fixup closure as light userdatas.
By the way, in the example of our serialization I sent you earlier, the
writer/reader functions were sent to save/load userdata's methods. Actually
they were closures with context in upvalues (to be totally correct, in
current implementation they are userdatas with __call metamethod, thanks to
flexibility of Lua :) ).