ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* Getting arguments by Lua
@ 2011-06-09 11:41 Procházka Lukáš Ing. - Pontex s. r. o.
  2011-06-09 11:57 ` Taco Hoekwater
  2011-06-09 13:22 ` Peter Münster
  0 siblings, 2 replies; 5+ messages in thread
From: Procházka Lukáš Ing. - Pontex s. r. o. @ 2011-06-09 11:41 UTC (permalink / raw)
  To: ConTeXt

Hello,

when I run context by e.g.:

context.exe Source.mkiv --result=Result.pdf --mode=Mode

is it possible to access the command line arguments from Lua?

I'm aware that modes are accessible by 'tex.modes' ('tex.modes.Mode' gives 'true' in this case);

but I'd need to get also the source file name ("Source.mkiv") and the option ("--result" -> "Result.pdf").

Is it possible anyhow?

Best regards,

Lukas


-- 
Ing. Lukáš Procházka [mailto:LPr@pontex.cz]
Pontex s. r. o.      [mailto:pontex@pontex.cz] [http://www.pontex.cz]
Bezová 1658
147 14 Praha 4

Tel: +420 244 062 238
Fax: +420 244 461 038

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

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Getting arguments by Lua
  2011-06-09 11:41 Getting arguments by Lua Procházka Lukáš Ing. - Pontex s. r. o.
@ 2011-06-09 11:57 ` Taco Hoekwater
  2011-06-09 11:59   ` Cedric Mauclair
  2011-06-09 12:39   ` Procházka Lukáš Ing. - Pontex s. r. o.
  2011-06-09 13:22 ` Peter Münster
  1 sibling, 2 replies; 5+ messages in thread
From: Taco Hoekwater @ 2011-06-09 11:57 UTC (permalink / raw)
  To: mailing list for ConTeXt users



On 06/09/11 13:41, Procházka Lukáš Ing. - Pontex s. r. o. wrote:
> Hello,
> 
> when I run context by e.g.:
> 
> context.exe Source.mkiv --result=Result.pdf --mode=Mode
> 
> is it possible to access the command line arguments from Lua?

the 'environment' table has information about this stuff.

In particular, environment.rawarguments matches the table
that lua calls 'arg'.

\directlua{print (table.serialize(environment.rawarguments))}


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

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Getting arguments by Lua
  2011-06-09 11:57 ` Taco Hoekwater
@ 2011-06-09 11:59   ` Cedric Mauclair
  2011-06-09 12:39   ` Procházka Lukáš Ing. - Pontex s. r. o.
  1 sibling, 0 replies; 5+ messages in thread
From: Cedric Mauclair @ 2011-06-09 11:59 UTC (permalink / raw)
  To: mailing list for ConTeXt users

Hello,

I think the tables document.arguments and documents.files might also
be of interest.

Regards.

-- Cédric



2011/6/9 Taco Hoekwater <taco@elvenkind.com>:
>
>
> On 06/09/11 13:41, Procházka Lukáš Ing. - Pontex s. r. o. wrote:
>> Hello,
>>
>> when I run context by e.g.:
>>
>> context.exe Source.mkiv --result=Result.pdf --mode=Mode
>>
>> is it possible to access the command line arguments from Lua?
>
> the 'environment' table has information about this stuff.
>
> In particular, environment.rawarguments matches the table
> that lua calls 'arg'.
>
> \directlua{print (table.serialize(environment.rawarguments))}
>
>
> Best wishes,
> Taco
> ___________________________________________________________________________________
> If your question is of interest to others as well, please add an entry to the Wiki!
>
> maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
> webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
> archive  : http://foundry.supelec.fr/projects/contextrev/
> wiki     : http://contextgarden.net
> ___________________________________________________________________________________
>
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Getting arguments by Lua
  2011-06-09 11:57 ` Taco Hoekwater
  2011-06-09 11:59   ` Cedric Mauclair
@ 2011-06-09 12:39   ` Procházka Lukáš Ing. - Pontex s. r. o.
  1 sibling, 0 replies; 5+ messages in thread
From: Procházka Lukáš Ing. - Pontex s. r. o. @ 2011-06-09 12:39 UTC (permalink / raw)
  To: ConTeXt

OK, thanks both for the answers.

Lukas


On Thu, 09 Jun 2011 13:57:27 +0200, Taco Hoekwater <taco@elvenkind.com> wrote:

>
>
> On 06/09/11 13:41, Procházka Lukáš Ing. - Pontex s. r. o. wrote:
>> Hello,
>>
>> when I run context by e.g.:
>>
>> context.exe Source.mkiv --result=Result.pdf --mode=Mode
>>
>> is it possible to access the command line arguments from Lua?
>
> the 'environment' table has information about this stuff.
>
> In particular, environment.rawarguments matches the table
> that lua calls 'arg'.
>
> \directlua{print (table.serialize(environment.rawarguments))}
>
>
> Best wishes,
> Taco
>

I think the tables document.arguments and documents.files might also
be of interest.

Regards.

-- Cédric

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

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Getting arguments by Lua
  2011-06-09 11:41 Getting arguments by Lua Procházka Lukáš Ing. - Pontex s. r. o.
  2011-06-09 11:57 ` Taco Hoekwater
@ 2011-06-09 13:22 ` Peter Münster
  1 sibling, 0 replies; 5+ messages in thread
From: Peter Münster @ 2011-06-09 13:22 UTC (permalink / raw)
  To: mailing list for ConTeXt users

On Thu, Jun 09 2011, Procházka Lukáš Ing. - Pontex s. r. o. wrote:

> but I'd need to get also the source file name ("Source.mkiv") and the option
> ("--result" -> "Result.pdf").

\starttext
result (lua): \ctxlua{context(environment.outputfilename)}\par
result (tex): \systemparameter{file}
\stoptext

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

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2011-06-09 13:22 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-06-09 11:41 Getting arguments by Lua Procházka Lukáš Ing. - Pontex s. r. o.
2011-06-09 11:57 ` Taco Hoekwater
2011-06-09 11:59   ` Cedric Mauclair
2011-06-09 12:39   ` Procházka Lukáš Ing. - Pontex s. r. o.
2011-06-09 13:22 ` Peter Münster

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).