tweak Vector3 FromLua

This commit is contained in:
Quaternions 2024-09-18 18:48:07 -07:00
parent cef0ce4c09
commit 129998e628

View File

@ -50,8 +50,8 @@ impl mlua::UserData for Vector3{
impl<'lua> mlua::FromLua<'lua> for Vector3{ impl<'lua> mlua::FromLua<'lua> for Vector3{
fn from_lua(value:mlua::prelude::LuaValue<'lua>,_lua:&'lua mlua::prelude::Lua)->mlua::prelude::LuaResult<Self>{ fn from_lua(value:mlua::prelude::LuaValue<'lua>,_lua:&'lua mlua::prelude::Lua)->mlua::prelude::LuaResult<Self>{
match value{ match value{
mlua::Value::UserData(ud) => Ok(*ud.borrow::<Self>()?), mlua::Value::UserData(ud)=>ud.take(),
_ => unreachable!(), other=>Err(mlua::Error::runtime(format!("Expected Vector3 got {:?}",other))),
} }
} }
} }