Hi again,
I’m converting a few macros into Lua (LMTX), but couldn’t find some answers in 
the docs:


* How translates \ifodd\realpageno ?

This doesn’t work:
if ((tex.getcount("realpageno") mod 2) == 1) then
 a = 1
end

I found tex.ifodd but don’t know how to use it either.


* How to access my \def’d macros?

Is this supposed to work?:

TeX:
\def\Something{1cm}

Lua:
context.Something()

(It doesn’t in my case, but if it should, I can investigate.)


* TeX primitives
Is tex.strut and tex.par supposed to work? Or how should I access these?


* interface definitions:

Lua:
interfaces.implement {
    name      = "MyFun",
    public    = true,
    --permanent = false, -- what does this mean?
    arguments = { "string", "string", "string", "string" },
    actions   = function(reference, y, text, filename)
        -- a lot
    end,
}

TeX:
\MyFun{ref:some}{1cm}{bla}{hacker}

0) I don’t understand what “permanent” does and why I should maybe disable it. 
(cld-mkiv, p.146)

1) The parameter y is actually supposed to be a dimension, but if I declare it 
"dimen", ConTeXt says there wasn’t a number at "1cm".
   Or is a measure like that not a dimension?

2) The original interface of \MyFun had two optional parameters. I couldn’t 
find how to do that with interfaces.implement.
   cld-mkiv, p.151 (12.7) shows how to do lists or key=value, but not single 
optional args.


I’d be glad to get a few hints.

Hraban
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : [email protected] / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

Reply via email to