\starttext
\startluacode
context(type(context.delayed))
\stopluacode
\stoptext
Long story short: context.cmda(context.delayed.cmdb(something)) will (possibly) work; context.cmdc({key=context.delayed.cmdd(somethingelse)}) won't.
Hans and Wolfgang can elaborate in case I've missed something.
Jairo :)
> as tables like those in setuphead({somehead}, {somesettings}) are actual Lua tables and follow Lua, not TeX, rulesBut there are lua apis that support delayed TeX like `context.chapter(context.delayed'text')`.Whether or not the function is stored in a table should be theoretically irrelevant.I guess there should be a switch somewhere that let the command recognized delayed function.___________________________________________________________________________________On Tue, 3 Nov 2020 at 03:29, Jairo A. del Rio <jairoadelrio6@gmail.com> wrote:On the Lua side, you'll have to pass strings so your example works, as tables like those in setuphead({somehead}, {somesettings}) are actual Lua tables and follow Lua, not TeX, rules (see e.g. Lua reference in https://www.lua.org/manual/5.4/ or, better, CLD manual in http://www.pragma-ade.nl/general/manuals/cld-mkiv.pdf):
\starttext
\startluacode
--First example
for m = 1, 3 do
context.setuphead({'chapter'}, {before='hello'})
context.startchapter({title="I'm a chapter!"})
for i = 1, 3 do
context.input("knuth")
end
context.stopchapter()
end
--Second example
--We'll pass some strings to TeX
local nice = "ConTeXt is love, ConTeXt is life"
local somehead = 'chapter'
local sometext = 'vallejo-trilce-es'
context.setuphead({somehead}, {before=nice})
context.startchapter({title=somehead})
context.input(sometext)
context.stopchapter()
\stopluacode
\stoptext
I hope examples help.
Regards,
Jairo :)
___________________________________________________________________________________El lun., 2 de nov. de 2020 a la(s) 21:09, Sylvain Hubert (champignoom@gmail.com) escribió:___________________________________________________________________________________Dear List,I'm trying to mirror the context command`\setuphead[chapter][before=hello]`into lua with delayed typesetting of 'hello', but`\ctxlua{context.setuphead({'chapter'}, {before=context.delayed'hello'})}`does not have any effect. Could anyone help me on this? Thanks!Best,Sylvain
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
___________________________________________________________________________________
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
___________________________________________________________________________________
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
___________________________________________________________________________________