diff --git a/CHANGELOG.md b/CHANGELOG.md index 6aa4c0ff..c25a151c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,15 @@ Rhai Release Notes ================== +Version 1.1.3 +============= + +Bug fixes +--------- + +* Reverses a regression on string `+` operations. + + Version 1.1.2 ============= diff --git a/src/packages/string_more.rs b/src/packages/string_more.rs index 5e2400a6..240d0adb 100644 --- a/src/packages/string_more.rs +++ b/src/packages/string_more.rs @@ -45,19 +45,28 @@ mod string_functions { s } - #[rhai_fn(name = "append")] + #[rhai_fn(name = "+", name = "append")] pub fn add_append_str(string1: ImmutableString, string2: ImmutableString) -> ImmutableString { string1 + string2 } - #[rhai_fn(name = "append")] + #[rhai_fn(name = "+", name = "append")] pub fn add_append_char(string: ImmutableString, character: char) -> ImmutableString { string + character } - #[rhai_fn(name = "append")] + #[rhai_fn(name = "+")] + pub fn add_prepend_char(character: char, string: ImmutableString) -> ImmutableString { + format!("{}{}", character, string).into() + } + + #[rhai_fn(name = "+", name = "append")] pub fn add_append_unit(string: ImmutableString, item: ()) -> ImmutableString { let _item = item; string } + #[rhai_fn(name = "+")] + pub fn add_prepend_unit(_item: (), string: ImmutableString) -> ImmutableString { + string + } #[rhai_fn(name = "len", get = "len")] pub fn len(string: &str) -> INT {