[luatex] Getting the extra primitives?

Taco Hoekwater taco at elvenkind.com
Tue Feb 16 12:55:41 CET 2010

Joseph Wright wrote:
> Thanks for that (and to Manuel too): I was not sure if there were any
> "pitfalls". Also, that simulates \pdfstrcmp itself, but I was wondering
> about doing the entire functions (missing out all of the \ifnum and
> \expandafter stuff). In partial pseudo-code (and using LaTeX3-style
> function naming):

I do not quite understand, but will try.

If you have this in the input


then you could use this definition


with the lua function defined like this:

function somefunction(A, B)
  if A == B then

you will need a tex helper definition for the backslashes in the string
if the function is itself defined inside a tex file:


> (Also, am I correct in thinking that there is no way to avoid needing 
> \unexpanded to get the string comparison "as is"?) 

That depends on the actual strings and the current catcode assignments
of course, but \directlua expands its argument, so yes, if you want to
compare control sequence names, you will need some way to make sure
they don't expand automatically.

Best wishes,

More information about the luatex mailing list