lua-users home
lua-l archive

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

On Thu, Oct 8, 2009 at 12:13 AM, Duncan Cross <> wrote:
>(feels like bad form to quote myself, so - entirely snipped)

Another subtle thing to watch out for is that, if you want to
serialize the global variable scope, it is easy to forget about the
string metatable which will still have its __index field set to the
*old* string table - so if you add custom functions to string, and
want to call them as methods, they seem to disappear after
serialization and deserializatin. The solution is to serialize not the
global variable scope itself but a temporary table that contains it,
as well as the string metatable, and possibly other base-type
metatables if you have set them.