Re: [NTG-context] Checking existence of a macro (control sequence) by Lua - problem after updating MkIV

2020-06-19 Thread Lukas/ConTeXt
Hello Hans, -- Původní e-mail -- { Od: Hans Hagen as you updated, it's just: \startluacode local defined = tokens.defined for _, v in ipairs{ "MyMacro", "MyMacWithPars", "Undefined", "DoNothing", "NonExisting" } do print(string.format("\letterpercent-12s",

Re: [NTG-context] Checking existence of a macro (control sequence) by Lua - problem after updating MkIV

2020-06-18 Thread Hans Hagen
On 6/18/2020 10:27 AM, Lukas/ConTeXt wrote: Hello, I'm using Hans' macro suggested some time before. I've just updated Ctx MkIV and my sample code: \starttext \def\MyMacro{Ahoj} \def\MyMacWithPars#1#2{Something} \def\Undefined{} \let\Undefined\undefined \def\DoNothing{}

Re: [NTG-context] Checking existence of a macro (control sequence) by Lua - problem after updating MkIV

2020-06-18 Thread Lukas/ConTeXt
Meer Komu: NTG ConTeXt Datum: 18. 6. 2020 12:25:42 Předmět: Re: [NTG-context] Checking existence of a macro (control sequence) by Lua - problem after updating MkIV " Why can you not simply use one of the doifundefined macro's? Something for example: \doifundefined{ExitStatus}{\gdef\ExitSta

Re: [NTG-context] Checking existence of a macro (control sequence) by Lua - problem after updating MkIV

2020-06-18 Thread Hans van der Meer
Why can you not simply use one of the doifundefined macro's? Something for example: \doifundefined{ExitStatus}{\gdef\ExitStatus{0}} % default to ok as in UNIX dr. Hans van der Meer > On 18 Jun 2020, at 10:27, Lukas/ConTeXt wrote: > > Hello, > I'm using Hans' macro suggested some time before.

[NTG-context] Checking existence of a macro (control sequence) by Lua - problem after updating MkIV

2020-06-18 Thread Lukas/ConTeXt
Hello, I'm using Hans' macro suggested some time before. I've just updated Ctx MkIV and my sample code: \starttext \def\MyMacro{Ahoj} \def\MyMacWithPars#1#2{Something} \def\Undefined{} \let\Undefined\undefined \def\DoNothing{} \let\DoNothing\donothing \startluacode if

Re: [NTG-context] Checking existence of a macro (control sequence) by Lua

2020-05-29 Thread context
Hello Hans, thank you for explanation and the nice how-to solution! Best regards, Lukas Because the macro actually *is* defined: as soon as tex sees \foo it reserves the name and gives it the meaning undefined, so even \undefined is defined. Anyway, that is why we have \ifdefined that

Re: [NTG-context] Checking existence of a macro (control sequence) by Lua

2020-05-29 Thread Hans Hagen
On 5/28/2020 11:24 PM, cont...@vivaldi.net wrote: Hello, one more question - why macros \Undefined and \DoNothing show "defined" although I (tried to) undefine them? \starttext   \def\MyMacro{Ahoj}   \def\MyMac#1#2{Something}   \def\Undefined{}   \let\Undefined\undefined  

Re: [NTG-context] Checking existence of a macro (control sequence) by Lua

2020-05-28 Thread context
Hello, one more question - why macros \Undefined and \DoNothing show "defined" although I (tried to) undefine them? \starttext \def\MyMacro{Ahoj} \def\MyMac#1#2{Something} \def\Undefined{} \let\Undefined\undefined \def\DoNothing{} \let\DoNothing\donothing \startluacode

Re: [NTG-context] Checking existence of a macro (control sequence) by Lua

2020-05-28 Thread context
Hello, thanks Henri and Hans for all solutions! On 2020-05-28 10:34, Hans Hagen wrote: On 5/28/2020 12:42 AM, cont...@vivaldi.net wrote: Hello, is it possible to check whether a macro exists (or - is it a non-\undefined control sequence) with Lua? Suppose: \starttext  

Re: [NTG-context] Checking existence of a macro (control sequence) by Lua

2020-05-28 Thread Hans Hagen
On 5/28/2020 12:42 AM, cont...@vivaldi.net wrote: Hello, is it possible to check whether a macro exists (or - is it a non-\undefined control sequence) with Lua? Suppose: \starttext   \def\MyMacro{Ahoj}   \def\MyMac#1#2{Something}   \startluacode     IsDefined = function(ctl_seq)   

Re: [NTG-context] Checking existence of a macro (control sequence) by Lua

2020-05-28 Thread Hans Hagen
On 5/28/2020 12:49 AM, luigi scarso wrote: On Thu, May 28, 2020 at 12:43 AM > wrote: Off-topic: your email are always marked as spam by my gmail . Are you sure that your address setup is ok  ? also, a reply to that vivaldi address always bounces (same for gmx

Re: [NTG-context] Checking existence of a macro (control sequence) by Lua

2020-05-28 Thread Henri Menke
On 28/05/20, 00:42, cont...@vivaldi.net wrote: > Hello, > > is it possible to check whether a macro exists (or - is it a non-\undefined > control sequence) with Lua? Suppose: > > > \starttext > \def\MyMacro{Ahoj} > \def\MyMac#1#2{Something} > > \startluacode > IsDefined =

[NTG-context] Checking existence of a macro (control sequence) by Lua

2020-05-27 Thread context
Hello, is it possible to check whether a macro exists (or - is it a non-\undefined control sequence) with Lua? Suppose: \starttext \def\MyMacro{Ahoj} \def\MyMac#1#2{Something} \startluacode IsDefined = function(ctl_seq) print("CS " .. ctl_seq ..

Re: [NTG-context] Checking existence of a macro (control sequence) by Lua

2020-05-27 Thread luigi scarso
On Thu, May 28, 2020 at 12:43 AM wrote: > Off-topic: your email are always marked as spam by my gmail . Are you sure that your address setup is ok ? -- luigi ___ If your question is of interest to others as well,