There is a token.set_char
but no token.get_char
.
Starting from
\chardef\MyNumber=1
I can change the value with
\directlua{
token.set_char('MyNumber', 421)
}
and retrieve the value on the TeX side
\the\MyNumber
but how to retrieve the value on the lua side?
I have one solution in mind but it is not satisfying: with tex.runtoks
, lua can ask tex to copy MyNumber to a dedicated count register, and then retrieve the value using tex.count
.