close
This commit is contained in:
parent
d84c48f336
commit
a8236265fd
@ -261,6 +261,46 @@ impl mlua::UserData for Instance{
|
||||
Some(&rbx_types::Variant::Vector3(v))=>return Ok(Into::<super::vector3::Vector3>::into(v).into_lua(lua)),
|
||||
_=>(),
|
||||
}
|
||||
//find a function with a matching name
|
||||
if let Some(ret)=class_functions_mut(lua,|cf|{
|
||||
let class_str=instance.class.as_str();
|
||||
Ok(match cf.classes.entry(class_str){
|
||||
std::collections::hash_map::Entry::Occupied(occupied_entry)=>{
|
||||
match occupied_entry.get().entry(index_str){
|
||||
std::collections::hash_map::Entry::Occupied(occupied_entry)=>{
|
||||
Some(occupied_entry.get())
|
||||
},
|
||||
std::collections::hash_map::Entry::Vacant(vacant_entry)=>{
|
||||
match CLASS_FUNCTION_DATABASE.get(class_str)
|
||||
.and_then(|class_functions|
|
||||
class_functions.get(index_str)
|
||||
)
|
||||
{
|
||||
Some(f_pointer)=>Some(&*vacant_entry.insert(lua.create_function(f_pointer)?)),
|
||||
None=>None,
|
||||
}
|
||||
},
|
||||
}
|
||||
},
|
||||
std::collections::hash_map::Entry::Vacant(vacant_entry)=>{
|
||||
match CLASS_FUNCTION_DATABASE.get(class_str)
|
||||
.and_then(|class_functions|
|
||||
class_functions.get(index_str)
|
||||
)
|
||||
{
|
||||
Some(f_pointer)=>{
|
||||
let mut h=HashMap::new();
|
||||
let lua_f=h.entry(index_str).or_insert(lua.create_function(f_pointer)?);
|
||||
vacant_entry.insert(h);
|
||||
Some(&*lua_f)
|
||||
},
|
||||
None=>None,
|
||||
}
|
||||
},
|
||||
})
|
||||
})?{
|
||||
return Ok(ret.into_lua(lua));
|
||||
}
|
||||
//find a child with a matching name
|
||||
Ok(
|
||||
find_first_child(dom,instance,index_str)
|
||||
|
Loading…
Reference in New Issue
Block a user