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:
http://lua-users.org/lists/lua-l/2008-02/msg01173.html
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?
Thanks!
Zach