Thanx very much to Hans. I see that you understood what I meant. I expected something like this probably will not do. I'll try to experiment according to your advice. You ask why do I need? It is hard for me to explain in English why I need it. Only shortly: I prepared a series of Lua functions, that accesses data from a CSV file in very general level. In fact I can in Luacycle print in ConTeXt (but in LuaLaTeX or LuaPlain too) any reports, forms, mail merge letters, etc. The user creates a report (using data of row of the CSV table). The user can in report use TeX macros, that are automaticaly creating during browsing of the CSV file. Macro names are derived from Excel table columns (\ cA, \ cB, \ cC, ...) or are created under the header (first line) CSV table. I had it working quite well, but I am trying now output from my applications to use as an input to the database module of Mojca Miklavec. The problem is that output of my application appears in the one macro (printmacro \printacion or maybe better \lineaction because it contains the row data of the CSV table). Unfortunately, I have a macro in unexpanded form (as one token), because it constantly changes according to the contents of the current row of CSV table, but Mojca module requires several values separated by separators. I hope at least someone can understand my bad English ... Sorry Taco :-) ... Thank you all for your patience with amateurs such as myself. I have great admiration for you all and I am privileged to be helping me. Thanks Jaroslav Dne 1.8.2010 17:08, Hans Hagen napsal(a):
On 1-8-2010 11:45, Jaroslav Hajtmar wrote:
\ctxlua{pars('\printaction')}
\blank[big]
Example 3)
The third example of my most interesting. Function parameter in example is a TeX macro \backslash printaction which not expanded, respectively expanded only when I printing it to TeX. Parameter of function is still string "\backslash printaction" in which it is futile to look for a comma separator. Comma not be found, although the content of macro face that is so. Is there a possibility for this case, as in some way to save to Lua variable content of macro (of course expanded)?
\ctxlua{pars('\\printaction')}
currently the tex parsing and expansion code is not available in luatex (future versions might provide some introspection or expansion code, but it's a hairy topic)
Anyhow, given that \printaction is defined you can use the token library to see what's in there (you then can sort of reconstruct the content).
Another approach is a two-step:
function step_1(str) -- str = \whatever tex.print("\ctxlua{step_2('",str,"')}") end
It all depends on what you want to do. Why do you want to look into \whatever?
Hans
----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com | www.pragma-pod.nl -----------------------------------------------------------------