On 10/13/20 7:14 PM, Wolfgang Schuster wrote: > Pablo Rodriguez schrieb am 13.10.2020 um 19:06: >> [...] >> In any case, I cannot compare to a number: >> >> \startluacode >> userdata = userdata or {} >> function userdata.numbersfname(name) >> return string.match(name, "%d+") >> end >> \stopluacode >> >> \define[1]\numbersfname >> {\cldcontext{userdata.numbersfname([==[#1]==])}} > > Untested: > > \defineexpandable[1]\numbersfname > {\cldcontext{userdata.numbersfname([==[#1]==])}}
I’m afraid it doesn’t work. \startluacode userdata = userdata or {} function userdata.numbersfname(name) return string.match(name, "%d+") end \stopluacode \defineexpandable[1]\numbersfname {\cldcontext{userdata.numbersfname([==[#1]==])}} \starttext \numbersfname{abc123} \numbersfname{\env{fname}} \doifelse{\numbersfname{\env{fname}}}{123}{yes}{no} \stoptext Just curious about what the difference might be. Many thanks for your help, Pablo -- http://www.ousia.tk ___________________________________________________________________________________ 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 ___________________________________________________________________________________