![](https://secure.gravatar.com/avatar/e5aa6984b53b8925e405ebbdbc051ad9.jpg?s=120&d=mm&r=g)
Hi, this should be easy: How can I access ConTeXt’s modes in Lua? Is it any different with language modes (*en)? e.g. \startluacode if context.modes['specialmode'] then context('I’m special.') end \stopluacode Greetlings, Hraban --- http://www.fiee.net http://wiki.contextgarden.net GPG Key ID 1C9B22FD
![](https://secure.gravatar.com/avatar/114f07f31e228d83eece631b0937df73.jpg?s=120&d=mm&r=g)
if tex.modes['specialmode'] then context('I’m special.') end Best greetings, Massi
Hi, this should be easy:
How can I access ConTeXt’s modes in Lua? Is it any different with language modes (*en)?
e.g.
\startluacode
if context.modes['specialmode'] then context('I’m special.') end
\stopluacode
![](https://secure.gravatar.com/avatar/5955e8e90611e77ccbfc7721b6112027.jpg?s=120&d=mm&r=g)
On 05/31/2017 11:03 AM, MF wrote:
if tex.modes['specialmode'] then context('I’m special.') end
Best greetings, Massi
Hi, this should be easy:
How can I access ConTeXt’s modes in Lua? Is it any different with language modes (*en)?
This is the way to detect system modes, but I don’t know how to do it for \mainlanguage (**en). \mainlanguage[es] \starttext \en\startlua if tex.systemmodes['en'] then context('Language is English.') else context('Language is not English.') end context('\\par') if tex.modes['es'] then context('Main language is Spanish.') else context('Main language is not Spanish.') end \stoplua \stoptext Just in case it help, Pablo -- http://www.ousia.tk
![](https://secure.gravatar.com/avatar/5955e8e90611e77ccbfc7721b6112027.jpg?s=120&d=mm&r=g)
On 05/31/2017 04:51 PM, Pablo Rodriguez wrote:
[...] This is the way to detect system modes, but I don’t know how to do it for \mainlanguage (**en).
It was simple (not even using tex.systemmodes): \mainlanguage[es] \starttext \en\startlua if tex.modes['*en'] then context('Language is English.') else context('Language is not English.') end context('\\par') if tex.modes['**es'] then context('Main language is Spanish.') else context('Main language is not Spanish.') end \stoplua \stoptext Just in case it helps, Pablo -- http://www.ousia.tk
![](https://secure.gravatar.com/avatar/49e63acb01f2ca80efce7eed08310ce8.jpg?s=120&d=mm&r=g)
On 5/31/2017 4:51 PM, Pablo Rodriguez wrote:
On 05/31/2017 11:03 AM, MF wrote:
if tex.modes['specialmode'] then context('I’m special.') end
Best greetings, Massi
Hi, this should be easy:
How can I access ConTeXt’s modes in Lua? Is it any different with language modes (*en)?
This is the way to detect system modes, but I don’t know how to do it for \mainlanguage (**en).
\mainlanguage[es] \starttext \en\startlua if tex.systemmodes['en'] then context('Language is English.') else context('Language is not English.') end context('\\par') if tex.modes['es'] then context('Main language is Spanish.') else context('Main language is not Spanish.') end \stoplua \stoptext
Just in case it help, tex.modes['*en'] tex.modes['**en']
tex.systemmodes['en'] tex.systemmodes['*en'] ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl -----------------------------------------------------------------
![](https://secure.gravatar.com/avatar/e5aa6984b53b8925e405ebbdbc051ad9.jpg?s=120&d=mm&r=g)
Thank you all!
Greetlings, Hraban
---
http://www.fiee.net
http://wiki.contextgarden.net
GPG Key ID 1C9B22FD
Am 2017-05-31 um 18:57 schrieb Hans Hagen
On 5/31/2017 4:51 PM, Pablo Rodriguez wrote:
This is the way to detect system modes, but I don’t know how to do it for \mainlanguage (**en). \mainlanguage[es] \starttext \en\startlua if tex.systemmodes['en'] then context('Language is English.') else context('Language is not English.') end context('\\par') if tex.modes['es'] then context('Main language is Spanish.') else context('Main language is not Spanish.') end \stoplua \stoptext Just in case it help, tex.modes['*en'] tex.modes['**en']
tex.systemmodes['en'] tex.systemmodes['*en']
participants (4)
-
Hans Hagen
-
Henning Hraban Ramm
-
MF
-
Pablo Rodriguez