On 1/18/23 19:07, Hans Hagen via ntg-context wrote:
On 1/18/2023 6:47 PM, Pablo Rodriguez via ntg-context wrote: [...]
If I’m not wrong (in my previous statement), I think this is counterintuitive, since undefined commands are fine in TeX comments and undefined variables are fine inside \startluacode … \stopluacode.
I bet you'd complain if \the\scratchdimen would not expand. You cannot expect context to completely parse what goes into lua beforehand, unless you are willing to get a performance hit (apart from a waste of time).
I’m starting to understand that one cannot have it all. I haven’t used so much Lua code to add an undefined TeX command in a comment. Different reply isn’t wrong, only it needs to be known in advance.
Thanks for adding to the wiki,
I have discovered after the addition that this was explained before (last paragraph from https://wiki.contextgarden.net/Programming_in_LuaTeX#Calling_Lua_from_TeX). To emphasize it visually, I abused the <blockquote> element. If any wiki wizard knows better, please tell. Many thanks for your help, Pablo