I have a value defined in a macro, e.g.:
\mymacro{apple}
I need to check if a value does not equal a string, e.g.:
IF #1 NOT EQUAL TO "apple" THEN
PRINT "It is not a apple, it is #1."
FI
I have tried using this, but it does not work:
\ifx#1="apple"
\else
It is not a apple, it is #1.
\fi
I have also tried using this, but it also does not work:
\startlua
if #1 ~= "apple" then
context("It is not a apple, it is #1.")
end
\stoplua
- The macro might be set to any value.
- If anything other than "apple" appears inside, including TeX commands which do not create output, it should still be considered a negative result.
How can I create a plain TeX or Lua conditional which checks if the value is not equal?

\ctxcommand{doifelse([[#1]] == [[apple]])}{It is an apple.}{It is not a apple, it is #1.}. This of course expands everything in#1. – Philipp Gesang May 06 '12 at 07:51doifelse()deserves mention because you can evaluate arbitrary Lua code inside its argument. – Philipp Gesang May 07 '12 at 07:31