lua-users home
lua-l archive

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

于 2012-6-11 9:47, Zach Devito 写道:
I want to be able to serialize functions that share the same upvalue
and then restore the relationship on deserialization. This post from a
few years ago has a patch for vanilla Lua to do the same thing, and
more information on the problem:

I went ahead and patched LuaJIT 2 (beta10) to do this (the patch and a
very simple test is attached). It seems to work, but since I am not
familiar with the internals of LuaJIT, I am not confident that the
changes are completely correct. I am assuming that lua_shareupvalue is
only called on lua functions right after deserialization and before
they are first invoked.

Can anyone comment on whether this code should work in general, and on
any issues I might be missing?


LuaJIT has its own list now[1]. you might get more feedback there.