Hi,

 

I think you can use tex.write() instead of tex.print() (pretty much the same as in lua io functions).

Hope this helps

 

Joseph

 

De : Otared Kavian
Envoyé le :dimanche 19 mars 2017 16:31
À : mailing list for ConTeXt users
Objet :[NTG-context] How to use tex.print in ctxlua

 

Hi,

 

I would like to print in a text the values of a array computed in a  \startluacode …. \stopluacode combination.

How can I do it properly? Please have a look at the example below and its output, which is not satisfactory because the right parenthesis is separated from the number by a space. How can I suppress this unwanted space?

For instance I get (1, 103 ) instead of (1, 103).

 

Thanks in advance for any help,

Best regards: OK

 

%%% begin ctxlua-print.tex

\starttext

\startluacode

                n = 6 ;

                vecteurX = {} ;

                for i = 1,n do

                               vecteurX[i] = i ;

                end

                vecteurY = {} ;

                for i = 1,n do

                               vecteurY[i] = 3*vecteurX[i] + 100 ;

                end

                for i = 1,n do

                               context("(")

                               tex.print(vecteurX[i])

                               context(", ")

                               tex.print(vecteurY[i])

                               tex.print(")")

                               context.par()

                end

\stopluacode

\stoptext

%%% begin ctxlua-print.tex