Am 27.12.2008 um 12:20 schrieb Tad Ashlock:
I'm trying to create a ConTeXt macro (mkiv) that will manipulate the macro argument's text with Lua and then feed it back into ConTeXt with tex.print(). My approach worked correctly until I called the macro with \starttabulate ... \stoptabulate in the macro's argument. So I started reducing the problem down to a minimum example which surprisingly turned out to have nothing to do with the manipulations I was performing.
Here is the working example (without \starttabulate):
\long\def\testmacro#1{\directlua0{d='\luaescapestring{#1}'}} \starttext Hello, world! \testmacro{% testing} \stoptext
Here is the broken example:
\long\def\testmacro#1{\directlua0{d='\luaescapestring{#1}'}} \starttext Hello, world! \testmacro{% testing \starttabulate \NC 0 \NC testing tabulate. \NC \NR \stoptabulate} \stoptext
\def\testmacro {\bgroup \catcode`\\=12 \dotestmacro} \def\dotestmacro#1 {\ctxlua{d='\luaescapestring{#1}'}% \egroup} \starttext \testmacro{\starttabulate \NC text \NC text \NC\NR \stoptabulate} %\ctxlua{tex.sprint(d)} \stoptext Wolfgang