Re: [NTG-context] need help comparing strings

2020-10-13 Thread Pablo Rodriguez
On 10/13/20 7:14 PM, Wolfgang Schuster wrote: > Pablo Rodriguez schrieb am 13.10.2020 um 19:06: >> [...] >> In any case, I cannot compare to a number: >> >>\startluacode >> userdata = userdata or {} >> function userdata.numbersfname(name) >> return string.match(name, "%d+")

Re: [NTG-context] need help comparing strings

2020-10-13 Thread Pablo Rodriguez
On 10/13/20 5:33 PM, Pablo Rodriguez wrote: > [...] > \starttext > \ctxlua{ d = [[\env{fname}]] } > > d: \cldcontext{d}\\ > \doifelse{\cldcontext{d:match("\letterpercent d+")}} > {123}{yes}{no} > \stoptext > [...] > 3. I’m trying this on a Linux box, but on Windows I would say that

Re: [NTG-context] need help comparing strings

2020-10-13 Thread Wolfgang Schuster
Pablo Rodriguez schrieb am 13.10.2020 um 19:06: On 10/13/20 5:54 PM, Aditya Mahajan wrote: On Tue, 13 Oct 2020, Pablo Rodriguez wrote: [...] Could anyone explain me what I’m missing here? Many thanks for your reply, Aditya. I find it simpler to write macros where there is clean

Re: [NTG-context] need help comparing strings

2020-10-13 Thread Pablo Rodriguez
On 10/13/20 6:14 PM, Wolfgang Schuster wrote: > Pablo Rodriguez schrieb am 13.10.2020 um 17:33: >> [...] >> 2. Is there no Lua version of \getvariable{...}{...}? > > There is no need because everything is stored in a Lua table. > [...] > local argumentlist  = document.arguments.arguments >

Re: [NTG-context] need help comparing strings

2020-10-13 Thread Pablo Rodriguez
On 10/13/20 5:54 PM, Aditya Mahajan wrote: > On Tue, 13 Oct 2020, Pablo Rodriguez wrote: >> [...] >> Could anyone explain me what I’m missing here? Many thanks for your reply, Aditya. > I find it simpler to write macros where there is clean communicating > between tex and lua. For example: >

Re: [NTG-context] need help comparing strings

2020-10-13 Thread Wolfgang Schuster
Pablo Rodriguez schrieb am 13.10.2020 um 17:33: Dear list, I have the following sample: \starttext \def\numbersfname {\cldcontext{string.match([[\env{fname}]], "\letterpercent d+")}} \ctxlua{ c = context.getvariable("environment", "fname") or "a" } \ctxlua{ d = [[\env{fname}]]

Re: [NTG-context] need help comparing strings

2020-10-13 Thread Aditya Mahajan
On Tue, 13 Oct 2020, Pablo Rodriguez wrote: > Dear list, > > I have the following sample: > > \starttext > \def\numbersfname > {\cldcontext{string.match([[\env{fname}]], "\letterpercent d+")}} > \ctxlua{ c = context.getvariable("environment", "fname") or "a" } > \ctxlua{ d =

[NTG-context] need help comparing strings

2020-10-13 Thread Pablo Rodriguez
Dear list, I have the following sample: \starttext \def\numbersfname {\cldcontext{string.match([[\env{fname}]], "\letterpercent d+")}} \ctxlua{ c = context.getvariable("environment", "fname") or "a" } \ctxlua{ d = [[\env{fname}]] } tex: \numbersfname\\ \doifelse{}