Skip to content

Commit 1e76de1

Browse files
committed
Update docs to include warning about RegistryKey in callbacks
1 parent eb154e4 commit 1e76de1

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

src/types.rs

+5-4
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,11 @@ pub struct LightUserData(pub *mut c_void);
2424
/// difficult to use than the normal handle types, it is Send + Sync + 'static, which means that it
2525
/// can be used in many situations where it would be impossible to store a regular handle value.
2626
///
27-
/// Be warned, If you place this into Lua via a `UserData` type, it is *very easy* to accidentally
28-
/// cause reference cycles that the Lua garbage collector cannot resolve. Instead of placing a
29-
/// `RegistryKey` into a `UserData` type, prefer instead to use `UserData::set_user_value` /
30-
/// `UserData::get_user_value`.
27+
/// Be warned, If you place this into Lua via a `UserData` type or a rust callback, it is *very
28+
/// easy* to accidentally cause reference cycles that the Lua garbage collector cannot resolve.
29+
/// Instead of placing a `RegistryKey` into a `UserData` type, prefer instead to use
30+
/// `UserData::set_user_value` / `UserData::get_user_value`, and instead of moving a RegistryKey
31+
/// into a callback, prefer `Lua::scope`.
3132
pub struct RegistryKey {
3233
pub(crate) registry_id: c_int,
3334
pub(crate) unref_list: Arc<Mutex<Option<Vec<c_int>>>>,

0 commit comments

Comments
 (0)