On 2002年1月31日, J. Perkins wrote:
If you'll accept my 0ドル.02, the current implementation of
ref/unref seems a big hack. The ability to associate C and
script objects is an awfully important feature for an
embedded language, but the current method (indices into
the registry) seems an afterthought. At the very least, a
dedicated table should be set aside for refs, freeing the
registry for application use, and support re-added for
unlocked refs.
In the work version, the old ref/unref are just macros that use
luaL_ref, luaL_unref, and lua_rawgeti over the registry. These functions
can operate over any table. So, it is trivial to put your references in
your own dedicated table (which can be weak).