roblox_emulator: implement :service alias for GetService

This commit is contained in:
2025-04-22 18:44:39 -07:00
parent c0ad20d54c
commit f0b2470039

@ -377,9 +377,7 @@ type CFD=phf::Map<&'static str,// Class name
ClassFunctionPointer ClassFunctionPointer
> >
>; >;
static CLASS_FUNCTION_DATABASE:CFD=phf::phf_map!{ const GET_SERVICE:ClassFunctionPointer=cf!(|lua,_this,service:mlua::String|{
"DataModel"=>phf::phf_map!{
"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 ?
let service=&*service.to_str()?; let service=&*service.to_str()?;
@ -395,7 +393,11 @@ static CLASS_FUNCTION_DATABASE:CFD=phf::phf_map!{
other=>Err::<Instance,_>(mlua::Error::runtime(format!("Service '{other}' not supported"))), other=>Err::<Instance,_>(mlua::Error::runtime(format!("Service '{other}' not supported"))),
} }
}) })
}), });
static CLASS_FUNCTION_DATABASE:CFD=phf::phf_map!{
"DataModel"=>phf::phf_map!{
"service"=>GET_SERVICE,
"GetService"=>GET_SERVICE,
}, },
"Terrain"=>phf::phf_map!{ "Terrain"=>phf::phf_map!{
"FillBlock"=>cf!(|_lua,_,_:(crate::runner::cframe::CFrame,Vector3,crate::runner::r#enum::Enum)|mlua::Result::Ok(())) "FillBlock"=>cf!(|_lua,_,_:(crate::runner::cframe::CFrame,Vector3,crate::runner::r#enum::Enum)|mlua::Result::Ok(()))