Am 22.08.2012 um 09:19 schrieb Jaroslav Hajtmar
Hello all, Is it possible to create a new dimension ConTeXt register directly in Lua, or I have to first create the ConTeXt dimensional register and then to subsequently assign it a value?
Here is example:
\starttext \newdimen\mydimension \directlua{tex.setdimen("mydimension", 123)} \stoptext
works fine, but all like:
\starttext \directlua{tex.print([[\newdimen\myotherdimension]])} \directlua{tex.setdimen("myotherdimension", 123)} \directlua{tex.newdimen("myotherdimension")}
etc...
\stoptext
fails.
In addition, I am interested in whether directly in Lua to create a new counter as in the previous.
\starttext \newcount\mycount \directlua{ tex.setcount("mycount",125) }
again works, but anything like:
\starttext \directlua{tex.print([[\newcount\myothercount]])} \directlua{tex.newcount("myothercount")} etc...
\stoptext
again fails...
Is there any source or examples to study anything about it?
AFAIK there is no tex.setdimen but what’s the problem to use Lua tables to save the values. \starttext \ctxlua{mydimension = number.topoints(10000)} \ctxlua{context(mydimension)} \blank \ctxlua{myotherdimension = 123456} \ctxlua{context(number.tocentimeters(myotherdimension))} \stoptext Wolfgang