pub struct LuaRegistryKey { /* private fields */ }Expand description
An auto generated key into the Lua registry.
This is a handle to a value stored inside the Lua registry. Unlike the Table or Function
handle types, this handle is Send + Sync + 'static and can be returned outside of a call to
Lua::context. Also, rather than calling methods directly on it, you must instead retrieve the
value first by calling Context::registry_value inside a call to Lua::context.
It is not automatically garbage collected on Drop, but it can be removed with
Context::remove_registry_value, and instances not manually removed can be garbage collected
with Context::expire_registry_values.
Be warned, If you place this into Lua via a UserData type or a rust callback, it is very
easy to accidentally cause reference cycles that the Lua garbage collector cannot resolve.
Instead of placing a RegistryKey into a UserData type, prefer instead to use
UserData::set_user_value / UserData::get_user_value, and instead of moving a RegistryKey
into a callback, prefer Context::scope.