roblox_emulator: support Workspace & MaterialService via GetService

This commit is contained in:
Quaternions 2025-04-22 21:20:56 -07:00
parent 3f89f2c1c5
commit 8b6166f48e
Signed by: Quaternions
GPG Key ID: D0DF5964F79AC131

@ -427,7 +427,7 @@ const GET_SERVICE:ClassFunctionPointer=cf!(|lua,_this,service:mlua::String|{
//dom.root_ref()==this.referent ?
let service=&*service.to_str()?;
match service{
"Lighting"|"RunService"|"Players"=>{
"Lighting"|"RunService"|"Players"|"Workspace"|"MaterialService"=>{
let referent=find_first_child_of_class(dom,dom.root(),service)
.map(|instance|instance.referent())
.unwrap_or_else(||
@ -435,7 +435,7 @@ const GET_SERVICE:ClassFunctionPointer=cf!(|lua,_this,service:mlua::String|{
);
Ok(Instance::new_unchecked(referent))
},
other=>Err::<Instance,_>(mlua::Error::runtime(format!("Service '{other}' not supported"))),
other=>Err(mlua::Error::runtime(format!("Service '{other}' not supported"))),
}
})
});