diff --git a/include/behaviortree_cpp/scripting/operators.hpp b/include/behaviortree_cpp/scripting/operators.hpp index 3b1f323f7..2aed0fb06 100644 --- a/include/behaviortree_cpp/scripting/operators.hpp +++ b/include/behaviortree_cpp/scripting/operators.hpp @@ -252,7 +252,9 @@ struct ExprBinaryArithmetic : ExprBase } } } - else if (rhs_v.isString() && lhs_v.isString() && op == plus) + else if (op == plus && ((rhs_v.isString() && lhs_v.isString()) || + (rhs_v.isString() && lhs_v.isNumber()) || + (rhs_v.isNumber() && lhs_v.isString()))) { return Any(lhs_v.cast() + rhs_v.cast()); }