From b0df1fb3bdbbf8c7226050289ea12693dfdb4e5c Mon Sep 17 00:00:00 2001 From: Quaternions Date: Sat, 21 Sep 2024 14:21:23 -0700 Subject: [PATCH] clone once instead of twice --- src/runner/instance.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/runner/instance.rs b/src/runner/instance.rs index ac5aa6d..d17d86e 100644 --- a/src/runner/instance.rs +++ b/src/runner/instance.rs @@ -104,11 +104,11 @@ impl Instance{ Ok(instance.name.clone()) }) }); - fields.add_field_method_set("Name",|lua,this,val:String|{ - dom(lua,move|dom|{ + fields.add_field_method_set("Name",|lua,this,val:mlua::String|{ + dom(lua,|dom|{ let instance=this.get_mut(dom)?; //Why does this need to be cloned? - instance.name=val.clone(); + instance.name=val.to_str()?.to_owned(); Ok(()) }) });