Here is something bizarre ! (I mean I don't understand). I enter a content, let's say "Something" in the (global) variable context. In line 2 of the following code, as one may anticipate, we have the same printout for the content of context and for the literal Something. However, in line 3, the content of context and the literal Something are recognized different !
\luaexec{context="Something"}
§§\luaexec{tex.print(context)}§§Something§§\\
\ifthenelse{\equal{\luaexec{tex.print(context)}}{Something}}{egal}{different}
Is there a problem of catcode, that makes the two look identical when they are different ? should I prefer luadirect, directlua, etc. instead ?
In fact, I tried with \luadirect instead of \luaexec, and it seems working, sometimes (not very stable, as sometimes, in other contexts, it doesn't work).
\luaexec{context="Something"}
§§\luaexec{tex.print(context)}§§Something§§\\
\ifthenelse{\equal{\luadirect{tex.print(context)}}{Something}}{egal}{different}
How shall I assure that the content of the variable context is recognized exactly as the literal content ?
\luaexec
is not expandable.\luaexec
itself is not expandable. But why do you even compare these on the TeX level and not just use\directlua{tex.print(context == "Something")}
?tostring
, that is to say\directlua{tex.print(tostring(context == "Something"))}
.