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
local str = { [true] = "defined", [false] = "undefined" }
local function whatever(s)
context.type("\\" .. s)
context(" is " .. (tokens.defined(s) and "defined" or
"undefined")) --% Hans' way
context(" and is " .. str[token.is_defined(s)] .. ".") --% Henri's
way
context.par()
end
whatever("MyMacro")
whatever("MyMacroD")
whatever(" ")
whatever("-")
whatever("Undefined")
whatever("DoNothing")
\stopluacode
%\Undefined % Causes "! Undefined control sequence"
\stoptext
----
Gives:
"
\MyMacro is defined and is defined.
\MyMacroD is undefined and is undefined.
\ is defined and is defined.
\- is defined and is defined.
\Undefined is defined and is defined.
\DoNothing is defined and is defined.
"
Lukas
___________________________________________________________________________________
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://context.aanhet.net
archive : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___________________________________________________________________________________