Compare commits

...

3 Commits

Author SHA1 Message Date
db8e22c34d v0.3.2 error trait + Services constructor 2024-10-03 21:39:24 -07:00
a88debe9f1 Services::find_in 2024-10-03 21:35:00 -07:00
317400548d error trait 2024-10-03 21:22:43 -07:00
4 changed files with 13 additions and 2 deletions

2
Cargo.lock generated
View File

@ -318,7 +318,7 @@ dependencies = [
[[package]] [[package]]
name = "roblox_emulator" name = "roblox_emulator"
version = "0.3.1" version = "0.3.2"
dependencies = [ dependencies = [
"glam", "glam",
"mlua", "mlua",

View File

@ -1,6 +1,6 @@
[package] [package]
name = "roblox_emulator" name = "roblox_emulator"
version = "0.3.1" version = "0.3.2"
edition = "2021" edition = "2021"
repository = "https://git.itzana.me/StrafesNET/roblox_emulator" repository = "https://git.itzana.me/StrafesNET/roblox_emulator"
license = "MIT OR Apache-2.0" license = "MIT OR Apache-2.0"

View File

@ -5,6 +5,16 @@ pub struct Services{
pub game:Ref, pub game:Ref,
pub workspace:Ref, pub workspace:Ref,
} }
impl Services{
pub fn find_in(dom:&WeakDom)->Option<Self>{
Some(Services{
workspace:*dom.root().children().iter().find(|&&r|
dom.get_by_ref(r).is_some_and(|instance|instance.class=="Workspace")
)?,
game:dom.root_ref(),
})
}
}
pub fn new_place_with_instances_in_workspace(mut instance_dom:WeakDom)->(WeakDom,Services){ pub fn new_place_with_instances_in_workspace(mut instance_dom:WeakDom)->(WeakDom,Services){
//workspace //workspace

View File

@ -22,6 +22,7 @@ impl std::fmt::Display for Error{
} }
} }
} }
impl std::error::Error for Error{}
fn init(lua:&mlua::Lua)->mlua::Result<()>{ fn init(lua:&mlua::Lua)->mlua::Result<()>{
lua.sandbox(true)?; lua.sandbox(true)?;