change ClassFunctionPointer to include Self
This commit is contained in:
parent
fac1f318d7
commit
af4521493b
@ -333,16 +333,16 @@ impl mlua::UserData for Instance{
|
|||||||
/// A class function definition shorthand.
|
/// A class function definition shorthand.
|
||||||
macro_rules! cf{
|
macro_rules! cf{
|
||||||
($f:expr)=>{
|
($f:expr)=>{
|
||||||
|lua,this|$f(lua,FromLuaMulti::from_lua_multi(this,lua)?)?.into_lua_multi(lua)
|
|lua,this,args|$f(lua,this,FromLuaMulti::from_lua_multi(args,lua)?)?.into_lua_multi(lua)
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
type FPointer=fn(&mlua::Lua,mlua::MultiValue)->mlua::Result<mlua::MultiValue>;
|
type ClassFunctionPointer=fn(&mlua::Lua,Instance,mlua::MultiValue)->mlua::Result<mlua::MultiValue>;
|
||||||
// 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,FPointer>>=phf::phf_map!{
|
static CLASS_FUNCTION_DATABASE:phf::Map<&str,phf::Map<&str,ClassFunctionPointer>>=phf::phf_map!{
|
||||||
"DataModel"=>phf::phf_map!{
|
"DataModel"=>phf::phf_map!{
|
||||||
"GetService"=>cf!(|lua,(_this,service):(Instance,mlua::String)|{
|
"GetService"=>cf!(|lua,_this,service:mlua::String|{
|
||||||
dom_mut(lua,|dom|{
|
dom_mut(lua,|dom|{
|
||||||
//dom.root_ref()==this.referent ?
|
//dom.root_ref()==this.referent ?
|
||||||
match &*service.to_str()?{
|
match &*service.to_str()?{
|
||||||
@ -360,7 +360,7 @@ static CLASS_FUNCTION_DATABASE:phf::Map<&str,phf::Map<&str,FPointer>>=phf::phf_m
|
|||||||
}),
|
}),
|
||||||
},
|
},
|
||||||
"Terrain"=>phf::phf_map!{
|
"Terrain"=>phf::phf_map!{
|
||||||
"FillBlock"=>cf!(|_lua,_:(Instance,super::cframe::CFrame,Vector3,super::r#enum::Enum)|mlua::Result::Ok(()))
|
"FillBlock"=>cf!(|_lua,_,_:(super::cframe::CFrame,Vector3,super::r#enum::Enum)|mlua::Result::Ok(()))
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user