use find_default_property
This commit is contained in:
parent
701897b00d
commit
e2c74b8dfe
@ -88,8 +88,9 @@ impl mlua::UserData for Instance{
|
|||||||
dom(lua,|dom|{
|
dom(lua,|dom|{
|
||||||
let instance=this.get_mut(dom)?;
|
let instance=this.get_mut(dom)?;
|
||||||
let index_str=index.to_str()?;
|
let index_str=index.to_str()?;
|
||||||
let class=rbx_reflection_database::get().classes.get(instance.class.as_str()).ok_or(mlua::Error::runtime("Class missing"))?;
|
let db=rbx_reflection_database::get();
|
||||||
let property=class.default_properties.get(index_str).ok_or(mlua::Error::runtime(format!("Property '{index_str}' missing on class '{}'",class.name)))?;
|
let class=db.classes.get(instance.class.as_str()).ok_or(mlua::Error::runtime("Class missing"))?;
|
||||||
|
let property=db.find_default_property(class,index_str).ok_or(mlua::Error::runtime(format!("Property '{index_str}' missing on class '{}'",class.name)))?;
|
||||||
match property{
|
match property{
|
||||||
rbx_types::Variant::Vector3(_)=>{
|
rbx_types::Variant::Vector3(_)=>{
|
||||||
let typed_value:Vector3=value.as_userdata().ok_or(mlua::Error::runtime("Expected Userdata"))?.take()?;
|
let typed_value:Vector3=value.as_userdata().ok_or(mlua::Error::runtime("Expected Userdata"))?.take()?;
|
||||||
|
Loading…
Reference in New Issue
Block a user