Let mutable userdata references in functions

This commit is contained in:
SeanOMik 2024-01-27 16:01:50 -05:00
parent 044b08a10e
commit bb692951db
1 changed files with 7 additions and 0 deletions

View File

@ -287,4 +287,11 @@ impl<'a, T: Userdata> FromLua<'a> for &'a T {
let ud = val.into_userdata()?;
ud.as_ref::<T>()
}
}
impl<'a, T: Userdata> FromLua<'a> for &'a mut T {
fn from_lua(_lua: &'a State, val: Value<'a>) -> crate::Result<Self> {
let ud = val.into_userdata()?;
ud.as_mut::<T>()
}
}