Jaroslav Hajtmar wrote:
Hello everybody.
Is there any possibility discover through Lua in ConTeXt whether it has been defined in ConTeXt source any regular TeX macros?
\starttext \directlua{print(token.command_name(token.create('starttext')))} \directlua{print(token.command_name(token.create('starttextx')))} \stoptext In short: if the result of command_name is "undefined_cs", the corresponding identifier is undefined (at this moment at this level). What command_name returns is a string representation of the internal command, of which there are some 140. normal macros are "call", conditionals are "if_test", box commands are "box_set", etc. There is no list of returned names in the manual, but you can generate one by something like this: \directlua{ i=0 while i<200 do v = token.command_name({i,0,0}) if not v then break end print(i, v) i=i+1 end} Alternatively, you can do this: \directlua{print(token.csname_name(token.create('starttext')))} if the returned string is empty, the command was undefined, otherwise you get the string back that you gave yourself (but with this option you don't know what kind of command it was). Best wishes, Taco