[NTG-context] Howto use the lua io.read() function only in the first context run?

Hans Hagen pragma at wxs.nl
Tue Mar 15 22:55:47 CET 2016


On 3/15/2016 9:04 PM, Romain Diss wrote:
> Hi all,
>
> I want to write a cld document with some data read on the standard
> input. I'm using the lua io.read() function but it's launched at every
> context passes (depending on the case, it is launched 2 to 3 times).
>
> -- Minimum not working example
> local name = io.read()
> context.startdocument()
> context("Hello " .. name)
> context.stopdocument()

you can test for environment.arguments.currentrun being "1"

-----------------------------------------------------------------
                                           Hans Hagen | PRAGMA ADE
               Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
       tel: 038 477 53 69 | www.pragma-ade.com | www.pragma-pod.nl
-----------------------------------------------------------------


More information about the ntg-context mailing list