From f4dc80713f2dd5ba418d55555f5af3a0284275ea Mon Sep 17 00:00:00 2001 From: Quaternions Date: Fri, 4 Oct 2024 19:32:30 -0700 Subject: [PATCH] Instance.Destroy --- src/runner/instance.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/runner/instance.rs b/src/runner/instance.rs index 49714e0..093897c 100644 --- a/src/runner/instance.rs +++ b/src/runner/instance.rs @@ -219,6 +219,12 @@ impl Instance{ Ok(crate::context::class_is_a(instance.class.as_str(),classname.to_str()?)) }) ); + methods.add_method("Destroy",|lua,this,()| + dom(lua,|dom|{ + dom.destroy(this.referent()); + Ok(()) + }) + ); methods.add_meta_function(mlua::MetaMethod::Index,|lua,(this,index):(mlua::AnyUserData,mlua::String)|{ let index_str=index.to_str()?; let dereferent:Dereferent=mlua::AnyUserDataExt::get(&this,"Referent")?;