Skip to content

Commit

Permalink
Add support to concat strings and numbers in scripting. Solves Behavi…
Browse files Browse the repository at this point in the history
  • Loading branch information
bochen87 committed Feb 13, 2024
1 parent 2c2efef commit 150ea37
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion include/behaviortree_cpp/scripting/operators.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<std::string>() + rhs_v.cast<std::string>());
}
Expand Down

0 comments on commit 150ea37

Please sign in to comment.