Hello,
However, if I run this with my own format, the pattern is:
How does that work, running this example in your format? I saved your example as weird.tex (attached), but
luatex -fmt=luaktex weird
gives me:
This is LuaTeX, Version snapshot-0.20.1-2007121015 (Web2C 7.5.6) (weird.tex ! Undefined control sequence. l.7 \directlua 0{\unexpanded{ ? x
I'm sorry, I forgot to note that for "weird.tex" to run with luaktex, all primitives have to be prefixed with ":": ------------------------------------------------------------------------ \:directlua0{\:unexpanded{ whiteSpace = lpeg.S(" \t\n") splitComma = lpeg.P({ lpeg.Ct(lpeg.V("elem") * (lpeg.V("sep") * lpeg.V("elem"))^0), sep = lpeg.S(",{}"), elem = whiteSpace^0 * lpeg.C((1 - lpeg.V("sep"))^1) * whiteSpace^0, % B }) }} \:def\splitComma#1{% \:directlua0{% local s = '\:luaescapestring{\:unexpanded{#1}}' local t = lpeg.match(splitComma,s) for k,v in ipairs(t) do texio.write_nl('[' .. v .. ']') end }% } \splitComma{A, B, C, D, E, F} % `print' is not documented, but prints a compiled pattern's bytecode % to the console \:directlua0{lpeg.print(splitComma)} ------------------------------------------------------------------------ This should work.
Best wishes, Taco
Jonathan