From 701897b00d25057e92e0c335ab6251a089a3c47f Mon Sep 17 00:00:00 2001 From: Quaternions Date: Fri, 20 Sep 2024 17:54:16 -0700 Subject: [PATCH] coerce_float32 --- src/runner/instance.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/runner/instance.rs b/src/runner/instance.rs index 1289826..b0719be 100644 --- a/src/runner/instance.rs +++ b/src/runner/instance.rs @@ -30,7 +30,7 @@ fn dom(lua:&mlua::Lua,mut f:impl FnMut(&mut WeakDom)->mlua::Result)->mlua: f(&mut *dom) } -fn coerce_float(value:&mlua::Value)->Option{ +fn coerce_float32(value:&mlua::Value)->Option{ match value{ &mlua::Value::Integer(i)=>Some(i as f32), &mlua::Value::Number(f)=>Some(f as f32), @@ -96,7 +96,7 @@ impl mlua::UserData for Instance{ instance.properties.insert(index_str.to_owned(),rbx_types::Variant::Vector3(typed_value.into())); }, rbx_types::Variant::Float32(_)=>{ - let typed_value:f32=coerce_float(&value).ok_or(mlua::Error::runtime("Expected f32"))?; + let typed_value:f32=coerce_float32(&value).ok_or(mlua::Error::runtime("Expected f32"))?; instance.properties.insert(index_str.to_owned(),rbx_types::Variant::Float32(typed_value)); }, other=>println!("Unimplemented property type: {other:?}"),