From 58edaf329143bd7351ddeb717fd7963506079a79 Mon Sep 17 00:00:00 2001 From: Quaternions Date: Sat, 5 Oct 2024 21:52:12 -0700 Subject: [PATCH] Instance.__index whole thing was wrong --- src/runner/instance.rs | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/src/runner/instance.rs b/src/runner/instance.rs index 3d9e257..c38e7e4 100644 --- a/src/runner/instance.rs +++ b/src/runner/instance.rs @@ -240,12 +240,12 @@ impl mlua::UserData for Instance{ //Find default value .or_else(||db.find_default_property(class,index_str)) { - Some(&rbx_types::Variant::Int32(val))=>return Ok(val.into_lua(lua)), - Some(&rbx_types::Variant::Int64(val))=>return Ok(val.into_lua(lua)), - Some(&rbx_types::Variant::Float32(val))=>return Ok(val.into_lua(lua)), - Some(&rbx_types::Variant::Float64(val))=>return Ok(val.into_lua(lua)), - Some(&rbx_types::Variant::CFrame(cf))=>return Ok(Into::::into(cf).into_lua(lua)), - Some(&rbx_types::Variant::Vector3(v))=>return Ok(Into::::into(v).into_lua(lua)), + Some(&rbx_types::Variant::Int32(val))=>return val.into_lua(lua), + Some(&rbx_types::Variant::Int64(val))=>return val.into_lua(lua), + Some(&rbx_types::Variant::Float32(val))=>return val.into_lua(lua), + Some(&rbx_types::Variant::Float64(val))=>return val.into_lua(lua), + Some(&rbx_types::Variant::CFrame(cf))=>return Into::::into(cf).into_lua(lua), + Some(&rbx_types::Variant::Vector3(v))=>return Into::::into(v).into_lua(lua), other=>println!("instance.properties.get(i)={other:?}"), } //find a function with a matching name @@ -264,14 +264,12 @@ impl mlua::UserData for Instance{ } }) })?{ - return Ok(function.into_lua(lua)); + return function.into_lua(lua); } //find a child with a matching name - Ok( - find_first_child(dom,instance,index_str) - .map(|instance|Instance::new(instance.referent())) - .into_lua(lua) - ) + find_first_child(dom,instance,index_str) + .map(|instance|Instance::new(instance.referent())) + .into_lua(lua) }) }); methods.add_meta_function(mlua::MetaMethod::NewIndex,|lua,(this,index,value):(Instance,mlua::String,mlua::Value)|{