From bb692951db13febf979c641ed4be394448fe9129 Mon Sep 17 00:00:00 2001 From: SeanOMik Date: Sat, 27 Jan 2024 16:01:50 -0500 Subject: [PATCH] Let mutable userdata references in functions --- src/userdata.rs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/userdata.rs b/src/userdata.rs index 884f259..be2dad0 100755 --- a/src/userdata.rs +++ b/src/userdata.rs @@ -287,4 +287,11 @@ impl<'a, T: Userdata> FromLua<'a> for &'a T { let ud = val.into_userdata()?; ud.as_ref::() } +} + +impl<'a, T: Userdata> FromLua<'a> for &'a mut T { + fn from_lua(_lua: &'a State, val: Value<'a>) -> crate::Result { + let ud = val.into_userdata()?; + ud.as_mut::() + } } \ No newline at end of file