roblox_emulator: support Workspace & MaterialService via GetService

This commit is contained in:
2025-04-22 21:20:56 -07:00
parent 3f89f2c1c5
commit 8b6166f48e

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