Thanx Wolfgang,

It looks very interesting... It can be used this method for example for macro definitions?

When I will return to the subject of this mail:
Can also be used for the council said Hans macros with multiple parameters?

For example macros without parameter is no problem:
context.setvalue('printline',calling.luafunction(),tex.par)
I assume that for a more parameters cannot be used context.setvalue (...) ..

But how to use multiple parameters when defining the macro as follows:
context([[\\def\\paramcontrol#1#2{%s}]],thirddata.scancsv.paramcontrol('#1', '#2'))

etc...

I want completely rewrite my entire module into LUA code (this means only lua file without TEX code)

Thanx Jaroslav



Dne 13.7.2011 14:56, Wolfgang Schuster napsal(a):
Am 13.07.2011 um 12:05 schrieb Jaroslav Hajtmar:

>  Great!!!!
>  Hans, thanx very much for complete an exhaustive answer..
>  It very help me to solve my module
A few dozen commands to access values aren’t a perfect solution,
there are better ways to access entries from a Lua table.

\starttext

\startusercode

entries = {
     one   = "1",
     two   = "2",
     three = "Three",
     five  = "More text!"
}

function getentry(name)
     local entry = entries[name] or ""
     global.context(entry)
end

\stopusercode

\define[1]\getentry{\usercode{getentry("#1")}}

\starttabulate
\NC one   \EQ \getentry{one}   \NC\NR
\NC two   \EQ \getentry{two}   \NC\NR
\NC three \EQ \getentry{three} \NC\NR
\NC four  \EQ \getentry{four}  \NC\NR
\NC five  \EQ \getentry{five}  \NC\NR
\stoptabulate

\stoptext

___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

Reply via email to