[luatex] accessing attribute registers (and other register types)
David Carlisle
d.p.carlisle at gmail.com
Wed Jun 17 16:15:26 CEST 2015
On 17 June 2015 at 15:07, Hans Hagen <pragma at wxs.nl> wrote:
>
> \attributedef\zeroattribute=0
> \attributedef\bar=999
>
> \directlua {
> function attributenumber(name)
> local n = newtoken.create(name).mode -
> newtoken.create("zeroattribute").mode
> if n >= 0 then
> return n
> else
> return false
> end
> end
> }
>
> \directlua{print(attributenumber("crap"))}
> \directlua{print(attributenumber("bar"))}
> \directlua{print(attributenumber("10>color"))}
> \directlua{print(attributenumber("10>colormodel"))}
>
> Hans
>
Hans, ah thanks much better, I almost got there, was experimenting with
newtoken.create(name)
but missed .mode somehow.
(Possibly the fact that It doesn't appear to be in the manual:-)
David
More information about the luatex
mailing list