Compare argument with literal question
dantenoguera opened this issue · comments
Hi! Is there a way to compare an argument with a literal, something like
<xacro:arg name="argument" default="foo"/>
<xacro:if value="${ $(arg argument) == 'foo' }">
...
</xacro:if>
I know I can do this:
<xacro:arg name="argument" default="foo"/>
<xacro:property="cmp_argument" value="$(arg argument)"/>
<xacro:if value="${ cmp_argument == 'foo' }">
...
</xacro:if>
but want to know if there is a better way.
Sure, you need to take the detour via a property:
<xacro:arg name="argument" default="foo"/>
<xacro:property name="argument" value="$(arg foo)"/>
<xacro:if value="${argument == 'foo'}">
...
</xacro:if>
Sorry. I didn't read your example to the end and proposed exactly what you tried before.
Up till now, there was no simpler method to do so. Take a look at #295 for an appropriate extension.