ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Wolfgang Schuster <wolfgang.schuster.lists@gmail.com>
To: mailing list for ConTeXt users <ntg-context@ntg.nl>,
	"Hamid,Idris" <Idris.Hamid@ColoState.EDU>
Subject: [NTG-context] Re: Some very simple cld - loading a module
Date: Fri, 18 Aug 2023 18:56:04 +0200	[thread overview]
Message-ID: <c01a60b4-3a63-1fb8-2f3d-e94aae0cd588@gmail.com> (raw)
In-Reply-To: <fb76ad46-f26b-45f9-a90a-6ee15bc2c187@Spark>

Hamid,Idris schrieb am 18.08.2023 um 17:30:
> Dear gang,
>
> The following, simple MWE gives an undefined control sequence error:
>
> =======
> % \usemodule[translate]
> % \enableinputtranslation
> \startluacode
>     -- context.usemodule({translate})
>     context.usemodule{translate}

context.usemodule({ "first" })

or

context.usemodule{ "first" }

>     context.enableinputtranslation()
>     context.darkgreen()
> \stopluacode
>
> \startTEXpage[offset=1em]
>
> \translateinput[Hermes][Idris]
>
> Hermes
>
> \disableinputtranslation
>
> Hermes
>
> \stopTEXpage
> =======
> tex error       > tex error on line 14 in file ./test-luacode.tex: 
> Undefined control sequence
>
> <line 3.12>
>     \translateinput
>     [Hermes][Idris]
> =======
>
> The reason for the error is that the module is not being loaded. 
> Toggling back to context syntax, of course, works.
>
> Reference: ConTeXt Lua Documents by Hans Hagen, page 22. The following 
> analogous code works:
>
> \startluacode
> context.startchapter{first}
> \stopluacode

It doesn't work or at least it does not what you expect, the examples in 
the manual pass strings ( "..." )
wherever text is expected while you pass a lua variable to the commands. 
Passing variables only work
when the variable itself refers to a string, e.g.

translate = "translate"

Wolfgang

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

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

  reply	other threads:[~2023-08-18 16:57 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-18 15:30 [NTG-context] " Hamid,Idris
2023-08-18 16:56 ` Wolfgang Schuster [this message]
2023-08-18 20:32   ` [NTG-context] " Hamid,Idris

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=c01a60b4-3a63-1fb8-2f3d-e94aae0cd588@gmail.com \
    --to=wolfgang.schuster.lists@gmail.com \
    --cc=Idris.Hamid@ColoState.EDU \
    --cc=ntg-context@ntg.nl \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).