Re: [NTG-context] Optimal way to defining of macros in Luacode in ConTeXt

2011-07-14 Thread Hans Hagen
On 14-7-2011 5:12, Jaroslav Hajtmar wrote: To show what macros I want to convert, I mention these examples: \def\opencsvfile{% \dosingleempty\doopencsvfile% } \def\doopencsvfile[#1]{% \dosinglegroupempty\dodoopencsvfile } \def\dodoopencsvfile#1{% \iffirstargument \ctxlua{thirddata.scancsv.ope

Re: [NTG-context] Optimal way to defining of macros in Luacode in ConTeXt

2011-07-14 Thread Jaroslav Hajtmar
Thanx very much Hans and Wolfgang too, I converted ALL my ConTeXt definitions (macros) with fixed numbers of parameters by using yours method - ie: interfaces.definecommand { name = "", macro = ., arguments = { { "content", "string" }, { "content", "

Re: [NTG-context] Optimal way to defining of macros in Luacode in ConTeXt

2011-07-13 Thread Hans Hagen
On 13-7-2011 4:09, Jaroslav Hajtmar wrote: But how to use multiple parameters when defining the macro as follows: context([[\\def\\paramcontrol#1#2{%s}]],thirddata.scancsv.paramcontrol('#1', '#2')) interfaces.definecommand { name = "TwoMandate", macro = thirddata.scancsv.param

Re: [NTG-context] Optimal way to defining of macros in Luacode in ConTeXt

2011-07-13 Thread Wolfgang Schuster
Am 13.07.2011 um 16:09 schrieb Jaroslav Hajtmar: > Thanx Wolfgang, > > It looks very interesting... It can be used this method for example for macro > definitions? It depends what you want to achieve, while you try to create many commands in the form \MacroXXX where each command contains some

Re: [NTG-context] Optimal way to defining of macros in Luacode in ConTeXt

2011-07-13 Thread Jaroslav Hajtmar
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.se

Re: [NTG-context] Optimal way to defining of macros in Luacode in ConTeXt

2011-07-13 Thread Wolfgang Schuster
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 \s

Re: [NTG-context] Optimal way to defining of macros in Luacode in ConTeXt

2011-07-13 Thread Jaroslav Hajtmar
Great Hans, thanx very much for complete an exhaustive answer.. It very help me to solve my module Regards Jaroslav Dne 13.7.2011 11:55, Hans Hagen napsal(a): On 13-7-2011 10:05, Jaroslav Hajtmar wrote: Hello all. It is GREAT! Thanx Hans and Wolfgang too. It is very instructive and inspir

Re: [NTG-context] Optimal way to defining of macros in Luacode in ConTeXt

2011-07-13 Thread Hans Hagen
On 13-7-2011 10:05, Jaroslav Hajtmar wrote: Hello all. It is GREAT! Thanx Hans and Wolfgang too. It is very instructive and inspiring for me... I was looking for something similar for a long time, but I have not found anything (not even in the CLD-MKIV and others ...). Finally, after yours reply

Re: [NTG-context] Optimal way to defining of macros in Luacode in ConTeXt

2011-07-13 Thread Jaroslav Hajtmar
Hello all. It is GREAT! Thanx Hans and Wolfgang too. It is very instructive and inspiring for me... I was looking for something similar for a long time, but I have not found anything (not even in the CLD-MKIV and others ...). Finally, after yours reply to this email find something in the ctx-ma

Re: [NTG-context] Optimal way to defining of macros in Luacode in ConTeXt

2011-07-12 Thread Wolfgang Schuster
Am 12.07.2011 um 17:30 schrieb Jaroslav Hajtmar: > Hello ConTeXist. > > How best (optimally) in Lua code in ConTeXt define own ConTeXt macros? > > I was used recently LuaTeX syntax (for example) : > tex.sprint(tex.ctxcatcodes,'\\def\\mymacro\{arg of mymacro\}') > > But someone advised me that

Re: [NTG-context] Optimal way to defining of macros in Luacode in ConTeXt

2011-07-12 Thread Hans Hagen
On 12-7-2011 5:30, Jaroslav Hajtmar wrote: But someone advised me that I use the better syntax: context('\\def\\Mymacro\{arg of mymacro\}') or context("\\def\\test#1{#1}") etc... whatever you like best context.setvalue{"Mymacro",somevalue) context([[\def\MyMacro#1{#1}]]) Exist other (best

[NTG-context] Optimal way to defining of macros in Luacode in ConTeXt

2011-07-12 Thread Jaroslav Hajtmar
Hello ConTeXist. How best (optimally) in Lua code in ConTeXt define own ConTeXt macros? I was used recently LuaTeX syntax (for example) : tex.sprint(tex.ctxcatcodes,'\\def\\mymacro\{arg of mymacro\}') But someone advised me that I use the better syntax: context('\\def\\Mymacro\{arg of mymacro\}