lua-users home
lua-l archive

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


On Thu, Jan 21, 2010 at 5:48 AM, Peter Cawley <lua@corsix.org> wrote:
>    * Pluto's options for [de]persisting userdata are limited. The
> literal persistence of userdata is inappropriate, as userdata based on
> C/C++ structures may be different sizes or endianness with different
> compiler settings and different platforms. This leaves just the fixup
> Lua closure option, which is appropriate for some userdata, but not
> for others. I would like to be able to have metamethods on userdata,
> which operate on a persistence API to write (and later read) arbitrary
> binary data and Lua objects.

I'd be interested to hear what types of userdata you found that can't
be appropriately handled through the closure method, as when I
originally designed it I spent quite a while trying to think of
something that it couldn't handle, and came up dry. In particular,
your serialization system's method of userdata handing -- manually
convert userdata to a bytestream and inject it into the file, then
manually deserialize it on loading -- can be easily modelled in Pluto
by a closure which encapsulates a call to the deserialization method,
and a string to pass to it. TBH, my own dislike of the special
persistence system was not its expressive power, to which I wasn't
able to discover any important limits, but its wordiness.

Ben