sorry for the noise if this is trivial, but I was unable to figure it out from the manual.

I have a dimen register \newdimen\foo
and want to set its value from within lua code.

tex.dimen.foo = 1000

works, but I'm unable to figure out how to do global settings or use tex.set on foo (locally or globally).

Using a register like "parindent" works fine:

\newdimen\foo
\foo = 12pt

\directlua{
  print("value of parindent: " .. tex.parindent)
  tex.parindent = 1000
  print("value of parindent: " .. tex.parindent)
  tex.set("parindent", 2000)
  print("value of parindent: " .. tex.parindent)
  tex.set("global", "parindent", 3000)
  print("value of parindent: " .. tex.parindent)
%
  print("value of foo: " .. tex.dimen.foo)
  tex.dimen.foo = 1000
  print("value of foo: " .. tex.dimen.foo)
  tex.set("foo", 2000)
  print("value of foo: " .. tex.dimen.foo)
  tex.set("global", "foo", 3000)
  print("value of foo: " .. tex.dimen.foo)
}
\bye

this gives:

value of parindent: 1000
value of parindent: 2000
value of parindent: 3000
value of foo: 786432
value of foo: 1000
value of foo: 1000
value of foo: 1000

what am I doing wrong?

thanks
frank


Reply via email to