Compare commits
2 Commits
85826a04bf
...
bf0c4f74c3
Author | SHA1 | Date | |
---|---|---|---|
bf0c4f74c3 | |||
97e2010826 |
@ -248,7 +248,7 @@ impl mlua::UserData for Instance{
|
|||||||
Some(&rbx_types::Variant::CFrame(cf))=>return Into::<super::cframe::CFrame>::into(cf).into_lua(lua),
|
Some(&rbx_types::Variant::CFrame(cf))=>return Into::<super::cframe::CFrame>::into(cf).into_lua(lua),
|
||||||
Some(&rbx_types::Variant::Vector3(v))=>return Into::<super::vector3::Vector3>::into(v).into_lua(lua),
|
Some(&rbx_types::Variant::Vector3(v))=>return Into::<super::vector3::Vector3>::into(v).into_lua(lua),
|
||||||
None=>(),
|
None=>(),
|
||||||
other=>println!("instance.properties.get(i)={other:?}"),
|
other=>return Err(mlua::Error::runtime(format!("Instance.__index Unsupported property type instance={} index={index_str} value={other:?}",instance.name))),
|
||||||
}
|
}
|
||||||
//find a function with a matching name
|
//find a function with a matching name
|
||||||
if let Some(function)=class_functions_mut(lua,|cf|{
|
if let Some(function)=class_functions_mut(lua,|cf|{
|
||||||
@ -345,7 +345,12 @@ type ClassFunctionPointer=fn(&mlua::Lua,mlua::MultiValue)->mlua::Result<mlua::Mu
|
|||||||
// TODO: use macros to define these with better organization
|
// TODO: use macros to define these with better organization
|
||||||
/// A double hash map of function pointers.
|
/// A double hash map of function pointers.
|
||||||
/// The class tree is walked by the Instance.__index metamethod to find available class methods.
|
/// The class tree is walked by the Instance.__index metamethod to find available class methods.
|
||||||
static CLASS_FUNCTION_DATABASE:phf::Map<&str,phf::Map<&str,ClassFunctionPointer>>=phf::phf_map!{
|
type CFD=phf::Map<&'static str,// Class name
|
||||||
|
phf::Map<&'static str,// Method name
|
||||||
|
ClassFunctionPointer
|
||||||
|
>
|
||||||
|
>;
|
||||||
|
static CLASS_FUNCTION_DATABASE:CFD=phf::phf_map!{
|
||||||
"DataModel"=>phf::phf_map!{
|
"DataModel"=>phf::phf_map!{
|
||||||
"GetService"=>cf!(|lua,_this,service:mlua::String|{
|
"GetService"=>cf!(|lua,_this,service:mlua::String|{
|
||||||
dom_mut(lua,|dom|{
|
dom_mut(lua,|dom|{
|
||||||
@ -374,7 +379,7 @@ static CLASS_FUNCTION_DATABASE:phf::Map<&str,phf::Map<&str,ClassFunctionPointer>
|
|||||||
#[derive(Default)]
|
#[derive(Default)]
|
||||||
struct ClassFunctions{
|
struct ClassFunctions{
|
||||||
classes:HashMap<&'static str,//ClassName
|
classes:HashMap<&'static str,//ClassName
|
||||||
HashMap<&'static str,//Function name
|
HashMap<&'static str,//Method name
|
||||||
mlua::Function
|
mlua::Function
|
||||||
>
|
>
|
||||||
>
|
>
|
||||||
|
Loading…
Reference in New Issue
Block a user