class function database can only return functions, not values

This commit is contained in:
Quaternions 2024-10-05 21:46:09 -07:00
parent 35d60cde16
commit d8aacb9ed2
2 changed files with 10 additions and 17 deletions

View File

@ -60,10 +60,19 @@ impl Context{
//insert services //insert services
let game=self.dom.root_ref(); let game=self.dom.root_ref();
let terrain_bldr=InstanceBuilder::new("Terrain");
let workspace=self.dom.insert(game, let workspace=self.dom.insert(game,
InstanceBuilder::new("Workspace") 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")); self.dom.insert(game,InstanceBuilder::new("Lighting"));
//transfer original root instances into workspace //transfer original root instances into workspace

View File

@ -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!{ "Terrain"=>phf::phf_map!{
"FillBlock"=>cf!(|_lua,_:(Instance,super::cframe::CFrame,Vector3,super::r#enum::Enum)|mlua::Result::Ok(())) "FillBlock"=>cf!(|_lua,_:(Instance,super::cframe::CFrame,Vector3,super::r#enum::Enum)|mlua::Result::Ok(()))