diff --git a/src/runner/instance.rs b/src/runner/instance.rs index 551c6ff..09bc459 100644 --- a/src/runner/instance.rs +++ b/src/runner/instance.rs @@ -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){