diff --git a/src/context.rs b/src/context.rs index 6f8c8f0..1d9017b 100644 --- a/src/context.rs +++ b/src/context.rs @@ -19,6 +19,14 @@ impl Context{ pub const fn new(dom:WeakDom)->Context{ Context{dom} } + pub fn script_singleton(source:String)->(Context,crate::runner::instance::Script){ + let dom=WeakDom::new( + rbx_dom_weak::InstanceBuilder::new("Script") + .with_property("Source",rbx_types::Variant::String(source)) + ); + let script=crate::runner::instance::Script::new(dom.root_ref()); + (Context{dom},script) + } pub fn from_mut(dom:&mut WeakDom)->&mut Context{ unsafe{&mut *(dom as *mut WeakDom as *mut Context)} }