Hello,
take the following PlainTeX example (as always ;-):
%&luatex
\catcode`@=11
\def\log#1{\immediate\write\sixt@@n{#1}}
\let~\space
\tracingassigns1
\tracingrestores1
\tracingonline1
\count@=5
\log{Before:~~~~~~~~~~~~~~~~~\the\count@}
\begingroup
\directlua0{tex.count["count@"]=23}
\log{In group:~~~~~~~~~~~~~~~\the\count@}
\endgroup
\log{After \string\endgroup:~~~~~~~~\the\count@}
\bye
This results in:
This is LuaTeX, Version snapshot-0.25.3-2008051713 (Web2C 7.5.6)
(Assignments.tex{into \tracingonline=1}
{changing \count255=92}
{into \count255=5}
Before: 5
{reassigning [no_local_whatsits]=0}
{reassigning [no_local_dirs]=0}
{changing \count255=5}
{into \count255=23}
In group: 23
{restoring \count255=5}
After \endgroup: 5
)
(see the transcript file for additional information)
No pages of output.
Transcript written on Assignments.log.
Now, a few months and betas ago, assignments made inside Lua to
tex.count et cetera were always global (see my posting on August 14th
2007 on this mailing list). Now it seems that they respect grouping.
Is this meant to stay or is it an unintended side-effect of some other
change? Looking into the source ('set_tex_count_register' in
luatex.web), it seems that this change is deliberate.
If it is a feature (which I'd be very grateful for, since it would
simplify a lot of things), how do I perform \global assignments in
Lua? As far as I can see from the source, I cannot pass an optional
third parameter to tex.setcount:
tex.setcount(