Instance: name

This commit is contained in:
Quaternions 2024-09-20 18:01:33 -07:00
parent ededfd9e55
commit ff76f3c865

View File

@ -52,6 +52,20 @@ impl mlua::UserData for Instance{
Ok(())
})
});
fields.add_field_method_get("Name",|lua,this|{
dom(lua,|dom|{
let instance=this.get(dom)?;
Ok(instance.name.clone())
})
});
fields.add_field_method_set("Name",|lua,this,val:String|{
dom(lua,move|dom|{
let instance=this.get_mut(dom)?;
//Why does this need to be cloned?
instance.name=val.clone();
Ok(())
})
});
}
fn add_methods<'lua,M:mlua::UserDataMethods<'lua,Self>>(methods:&mut M){