On 17 June 2015 at 15:07, Hans Hagen <[email protected]> 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

Reply via email to