From 96c8b1035a0791921809e8d549eacce132f9563e Mon Sep 17 00:00:00 2001 From: Quaternions Date: Fri, 4 Oct 2024 19:04:54 -0700 Subject: [PATCH] game.workspace --- src/runner/instance.rs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/runner/instance.rs b/src/runner/instance.rs index 9fbc645..792010c 100644 --- a/src/runner/instance.rs +++ b/src/runner/instance.rs @@ -298,6 +298,13 @@ class!(DataModel); class_composition!(DataModel,(Instance,DataModel)); impl DataModel{ fn composition_add_fields<'lua,T:Referent,F:mlua::UserDataFields<'lua,T>>(fields:&mut F){ + fields.add_field_method_get("workspace",|lua,this|{ + dom(lua,|dom|{ + Ok(find_first_child_of_class(dom,this.get(dom)?,"Workspace") + .map(|inst|Workspace::new(inst.referent())) + ) + }) + }); fields.add_field_method_get("PlaceId",|lua,this|{ Ok(mlua::Value::Integer(0)) });