From 129998e6286168ce69392b22a6dcc3b6fc19b8a0 Mon Sep 17 00:00:00 2001 From: Quaternions Date: Wed, 18 Sep 2024 18:48:07 -0700 Subject: [PATCH] tweak Vector3 FromLua --- src/runner/vector3.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/runner/vector3.rs b/src/runner/vector3.rs index 7fd6753..36aee3e 100644 --- a/src/runner/vector3.rs +++ b/src/runner/vector3.rs @@ -49,9 +49,9 @@ impl mlua::UserData 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{ - match value { - mlua::Value::UserData(ud) => Ok(*ud.borrow::()?), - _ => unreachable!(), + match value{ + mlua::Value::UserData(ud)=>ud.take(), + other=>Err(mlua::Error::runtime(format!("Expected Vector3 got {:?}",other))), } } }