From d8aacb9ed252e773c2aa7aae24ed1b72264988da Mon Sep 17 00:00:00 2001 From: Quaternions Date: Sat, 5 Oct 2024 21:46:09 -0700 Subject: [PATCH] class function database can only return functions, not values --- src/context.rs | 11 ++++++++++- src/runner/instance.rs | 16 ---------------- 2 files changed, 10 insertions(+), 17 deletions(-) diff --git a/src/context.rs b/src/context.rs index c86320c..92b1424 100644 --- a/src/context.rs +++ b/src/context.rs @@ -60,10 +60,19 @@ impl Context{ //insert services let game=self.dom.root_ref(); + let terrain_bldr=InstanceBuilder::new("Terrain"); let workspace=self.dom.insert(game, InstanceBuilder::new("Workspace") - .with_child(InstanceBuilder::new("Terrain")) + //Set Workspace.Terrain property equal to Terrain + .with_property("Terrain",terrain_bldr.referent()) + .with_child(terrain_bldr) ); + { + //Lowercase and upper case workspace property! + let game=self.dom.root_mut(); + game.properties.insert("workspace".to_owned(),rbx_types::Variant::Ref(workspace)); + game.properties.insert("Workspace".to_owned(),rbx_types::Variant::Ref(workspace)); + } self.dom.insert(game,InstanceBuilder::new("Lighting")); //transfer original root instances into workspace diff --git a/src/runner/instance.rs b/src/runner/instance.rs index 2e748ca..3d9e257 100644 --- a/src/runner/instance.rs +++ b/src/runner/instance.rs @@ -359,22 +359,6 @@ static CLASS_FUNCTION_DATABASE:phf::Map<&str,phf::Map<&str,FPointer>>=phf::phf_m } }) }), - "workspace"=>cf!(|lua,this:Instance|{ - dom_mut(lua,|dom|{ - Ok(find_first_child_of_class(dom,this.get(dom)?,"Workspace") - .map(|inst|Instance::new(inst.referent())) - ) - }) - }), - }, - "Workspace"=>phf::phf_map!{ - "Terrain"=>cf!(|lua,this:Instance|{ - dom_mut(lua,|dom|{ - Ok(find_first_child_of_class(dom,this.get(dom)?,"Terrain") - .map(|inst|Instance::new(inst.referent())) - ) - }) - }), }, "Terrain"=>phf::phf_map!{ "FillBlock"=>cf!(|_lua,_:(Instance,super::cframe::CFrame,Vector3,super::r#enum::Enum)|mlua::Result::Ok(()))