What I would like is to suppress the expansion of the group as a parameter to a macro so that it can be expanded later. For example we want to pass the paramater unmodified as a string to lua or to a file.
Let us suppose we have a macro \foo which accepts a parameter.
\def\foo#1{%
\directlua{foo([[#1]]}%
}
if we call it as:
\foo{\bar{abc}} the \bar gets expanded before \foo gets to see it.
Of course we can manually suppress the expansion with \foo{\noexpand\bar{abc}}, but can it be done automatically?

\directlua{foo([[\unexpanded{#1}]])}– egreg Oct 4 '12 at 11:13