Instance.Destroy

This commit is contained in:
Quaternions 2024-10-04 19:32:30 -07:00
parent 9030646f39
commit f4dc80713f

View File

@ -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")?;