Instance: name
This commit is contained in:
parent
ededfd9e55
commit
ff76f3c865
@ -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){
|
||||
|
Loading…
Reference in New Issue
Block a user