From a9a4ed2c46135e476ced62bdc8fbe28752753d03 Mon Sep 17 00:00:00 2001 From: Quaternions Date: Sat, 5 Oct 2024 13:10:57 -0700 Subject: [PATCH] default properties --- src/runner/instance.rs | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/runner/instance.rs b/src/runner/instance.rs index 7a3a5af..06355f9 100644 --- a/src/runner/instance.rs +++ b/src/runner/instance.rs @@ -251,10 +251,18 @@ impl Instance{ let dereferent:Dereferent=mlua::AnyUserDataExt::get(&this,"Referent")?; dom_mut(lua,|dom|{ let instance=dereferent.get(dom)?; - match instance.properties.get(index_str){ + //Find existing property + match instance.properties.get(index_str) + //Find default value + .or_else(||{ + let db=rbx_reflection_database::get(); + db.classes.get(instance.class.as_str()).and_then(|cd| + db.find_default_property(cd,index_str) + ) + }) + { 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)), - //None=>get_default_value _=>(), } //find a child with a matching name