Things seem not as simple as you suggest, at least on luatex 1.13.2. In next example, synctex_tag and synctex_line both survive the first \directlua call, so the state is not gone, which is a good thing
\directlua{ tex.set_synctex_tag(99) print(tex.get_synctex_tag()) tex.set_synctex_tag(199) tex.set_synctex_line(299) print(tex.get_synctex_line()) tex.set_synctex_line(399) } \directlua{ print(tex.get_synctex_tag()) print(tex.get_synctex_line()) } \bye In next example where \directlua is called from a macro, synctex_line survives the call but not synctex_tag. So some part of the state is gone, which is not practical. \def\Setter{ \directlua{ tex.set_synctex_tag(99) print(tex.get_synctex_tag()) tex.set_synctex_tag(199) tex.set_synctex_line(299) print(tex.get_synctex_line()) tex.set_synctex_line(399) } } \Setter \def\Getter{ \directlua{ print(tex.get_synctex_tag()) print(tex.get_synctex_line()) } } \Getter \bye > Le 28 mars 2022 à 14:40, Hans Hagen <j.ha...@xs4all.nl> a écrit : > > On 3/28/2022 1:32 PM, Jérôme LAURENS wrote: >> I do not really understand what is the relation with macro packages and _ >> because it is just raw luatex. > depends. i've seen it being an active character; anyway, > > \directlua{ > tex.set_synctex_tag(99) > print(tex.get_synctex_tag()) > tex.set_synctex_tag(199) > print(tex.get_synctex_tag()) > } > > does what it is supposed to do: sets the tag of the current input and reports > the tag of the current input and every \directlua pushed the stack so after > such a call that state is gone > > Hans > > > ----------------------------------------------------------------- > Hans Hagen | PRAGMA ADE > Ridderstraat 27 | 8061 GH Hasselt | The Netherlands > tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl > ----------------------------------------------------------------- > _______________________________________________ > dev-luatex mailing list > dev-luatex@ntg.nl > https://mailman.ntg.nl/mailman/listinfo/dev-luatex _______________________________________________ dev-luatex mailing list dev-luatex@ntg.nl https://mailman.ntg.nl/mailman/listinfo/dev-luatex