Compare commits
2 Commits
784dde3386
...
25577211b2
Author | SHA1 | Date | |
---|---|---|---|
25577211b2 | |||
fe91de5668 |
@ -267,12 +267,11 @@ impl mlua::UserData for Instance{
|
|||||||
database:db,
|
database:db,
|
||||||
descriptor:Some(class),
|
descriptor:Some(class),
|
||||||
};
|
};
|
||||||
iter.find_map(|class|
|
iter.find_map(|class|{
|
||||||
cf.get_or_create_class_methods(&class.name)
|
let mut class_methods=cf.get_or_create_class_methods(&class.name)?;
|
||||||
.and_then(|mut class_methods|
|
class_methods.get_or_create_function(lua,index_str)
|
||||||
class_methods.get_or_create_function(lua,index_str).transpose()
|
.transpose()
|
||||||
)
|
}).transpose()
|
||||||
).transpose()
|
|
||||||
})?{
|
})?{
|
||||||
return function.into_lua(lua);
|
return function.into_lua(lua);
|
||||||
}
|
}
|
||||||
@ -296,7 +295,7 @@ impl mlua::UserData for Instance{
|
|||||||
let property=iter.find_map(|cls|cls.properties.get(index_str)).ok_or(mlua::Error::runtime(format!("Property '{index_str}' missing on class '{}'",class.name)))?;
|
let property=iter.find_map(|cls|cls.properties.get(index_str)).ok_or(mlua::Error::runtime(format!("Property '{index_str}' missing on class '{}'",class.name)))?;
|
||||||
match &property.data_type{
|
match &property.data_type{
|
||||||
rbx_reflection::DataType::Value(rbx_types::VariantType::Vector3)=>{
|
rbx_reflection::DataType::Value(rbx_types::VariantType::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"))?.borrow()?;
|
||||||
instance.properties.insert(index_str.to_owned(),rbx_types::Variant::Vector3(typed_value.into()));
|
instance.properties.insert(index_str.to_owned(),rbx_types::Variant::Vector3(typed_value.into()));
|
||||||
},
|
},
|
||||||
rbx_reflection::DataType::Value(rbx_types::VariantType::Float32)=>{
|
rbx_reflection::DataType::Value(rbx_types::VariantType::Float32)=>{
|
||||||
@ -312,7 +311,7 @@ impl mlua::UserData for Instance{
|
|||||||
Ok(rbx_types::Enum::from_u32(*e.items.get(&*s.to_str()?).ok_or(mlua::Error::runtime("Invalid enum item"))?))
|
Ok(rbx_types::Enum::from_u32(*e.items.get(&*s.to_str()?).ok_or(mlua::Error::runtime("Invalid enum item"))?))
|
||||||
},
|
},
|
||||||
mlua::Value::UserData(any_user_data)=>{
|
mlua::Value::UserData(any_user_data)=>{
|
||||||
let e:super::r#enum::Enum=any_user_data.take()?;
|
let e:super::r#enum::Enum=*any_user_data.borrow()?;
|
||||||
Ok(e.into())
|
Ok(e.into())
|
||||||
},
|
},
|
||||||
_=>Err(mlua::Error::runtime("Expected Enum")),
|
_=>Err(mlua::Error::runtime("Expected Enum")),
|
||||||
@ -320,7 +319,7 @@ impl mlua::UserData for Instance{
|
|||||||
instance.properties.insert(index_str.to_owned(),rbx_types::Variant::Enum(typed_value));
|
instance.properties.insert(index_str.to_owned(),rbx_types::Variant::Enum(typed_value));
|
||||||
},
|
},
|
||||||
rbx_reflection::DataType::Value(rbx_types::VariantType::Color3)=>{
|
rbx_reflection::DataType::Value(rbx_types::VariantType::Color3)=>{
|
||||||
let typed_value:super::color3::Color3=value.as_userdata().ok_or(mlua::Error::runtime("Expected Color3"))?.take()?;
|
let typed_value:super::color3::Color3=*value.as_userdata().ok_or(mlua::Error::runtime("Expected Color3"))?.borrow()?;
|
||||||
instance.properties.insert(index_str.to_owned(),rbx_types::Variant::Color3(typed_value.into()));
|
instance.properties.insert(index_str.to_owned(),rbx_types::Variant::Color3(typed_value.into()));
|
||||||
},
|
},
|
||||||
rbx_reflection::DataType::Value(rbx_types::VariantType::Bool)=>{
|
rbx_reflection::DataType::Value(rbx_types::VariantType::Bool)=>{
|
||||||
|
Loading…
Reference in New Issue
Block a user