diff options
author | kyren <kerriganw@gmail.com> | 2017-07-30 14:57:35 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-07-30 14:57:35 -0400 |
commit | 8ba3886c96e4696b2a899a2838fbec9045f48a9b (patch) | |
tree | e2e7e38131b8a51f80d218a5df38b9813a8aa58f /src | |
parent | 387e62580ef3854566b62e134cf0d5c20153b713 (diff) | |
parent | acabc3ec18df8a91f7a7355e6c5ade770e3c3518 (diff) | |
download | mlua-8ba3886c96e4696b2a899a2838fbec9045f48a9b.zip |
Merge pull request #31 from jonas-schievink/clone-userdata
Relax requirements for UserData to impl FromLua
Diffstat (limited to 'src')
-rw-r--r-- | src/conversion.rs | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/conversion.rs b/src/conversion.rs index 6fac7e6..bd5cb76 100644 --- a/src/conversion.rs +++ b/src/conversion.rs @@ -103,10 +103,10 @@ impl<'lua, T: UserData> ToLua<'lua> for T { } } -impl<'lua, T: UserData + Copy> FromLua<'lua> for T { +impl<'lua, T: UserData + Clone> FromLua<'lua> for T { fn from_lua(value: Value<'lua>, _: &'lua Lua) -> Result<T> { match value { - Value::UserData(ud) => Ok(*ud.borrow::<T>()?), + Value::UserData(ud) => Ok(ud.borrow::<T>()?.clone()), _ => Err(Error::FromLuaConversionError( "cannot convert lua value to userdata".to_owned(), )), |