Very interesting indeed. So the documentation is inaccurate when it states that synctex_line is stacked (p210 of the manual).
The second interesting thing is that getters can only access values changed by setters, but how can we access values changed by force?


Le 29 mars 2022 à 09:57, Hans Hagen <j.hagen@xs4all.nl> a écrit :

On 3/29/2022 6:12 AM, Jérôme LAURENS wrote:
[…]
\directlua{
tex.set_synctex_tag(11)
tex.set_synctex_line(22)
}
\def\MyMacro{
\directlua{
tex.force_synctex_tag(111)
tex.force_synctex_line(222)
}}
\MyMacro
\directlua{
print("FAILURE 111 expected:", tex.get_synctex_tag())
print("FAILURE 222 expected:", tex.get_synctex_line())
}
\bye
the tag is stores in the input state and reading from (pseudo) files as well as macro expansion and expanding pushed (back) token lists bump the pointer

a line in tex is only reliable when it refers to a file; the extra synctex line states are global and can be used as overload but it assumes one knows where and what happens at that point

the setters and getters are pretty simple and consistent: tag is stacked, the others aren't
[…]

-----------------------------------------------------------------
                                         Hans Hagen | PRAGMA ADE
             Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
      tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl
-----------------------------------------------------------------