expansion and doifelse

Hello, Here's a MNWE: ------------------------------- \starttext \def\A{a} %\def\A{b} \ctxlua{LuaA("\doifelse{\A}{a}{ey}{bee}")} \stoptext ------------------------------- I put \expanded and \expandafter here and there, but couldn't get this to work. Is the problem due to \doifelse scanning its input? If yes, how can we handle this? Thanks, Mohammad

On 2025-03-29 11:22, Mohammad Hossein Bateni wrote:
\starttext \def\A{a} %\def\A{b} \ctxlua{LuaA("\doifelse{\A}{a}{ey}{bee}")} \stoptext
This works: \starttext \def\A{a} \def\A{b} \cldcontext{"\\doifelse{\\A}{a}{ey}{bee}"} \stoptext as does this: \starttext \def\A{a} \def\A{b} \ctxlua{context("\\doifelse{\\A}{a}{ey}{bee}")} \stoptext -- Rik

In my case, the Lua function will run some processing on the input from
\doifelse.
On Sat, Mar 29, 2025 at 12:18 PM Rik Kabel
On 2025-03-29 11:22, Mohammad Hossein Bateni wrote:
\starttext \def\A{a} %\def\A{b} \ctxlua{LuaA("\doifelse{\A}{a}{ey}{bee}")} \stoptext
This works:
\starttext \def\A{a} \def\A{b} \cldcontext{"\\doifelse{\\A}{a}{ey}{bee}"} \stoptext
as does this:
\starttext \def\A{a} \def\A{b} \ctxlua{context("\\doifelse{\\A}{a}{ey}{bee}")} \stoptext
-- Rik
___________________________________________________________________________________ If your question is of interest to others as well, please add an entry to the Wiki!
maillist : ntg-context@ntg.nl / https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl webpage : https://www.pragma-ade.nl / https://context.aanhet.net (mirror) archive : https://github.com/contextgarden/context wiki : https://wiki.contextgarden.net
___________________________________________________________________________________

Am 29.03.2025 um 16:22 schrieb Mohammad Hossein Bateni:
Hello,
Here's a MNWE:
------------------------------- \starttext \def\A{a} %\def\A{b} \ctxlua{LuaA("\doifelse{\A}{a}{ey}{bee}")} \stoptext -------------------------------
I put \expanded and \expandafter here and there, but couldn't get this to work.
Is the problem due to \doifelse scanning its input? If yes, how can we handle this?
Replace \doifelse with \expdoifelse or \expandeddoifelse. Wolfgang

Thanks! That's what I needed. --Mohammad On Sat, Mar 29, 2025 at 2:23 PM Wolfgang Schuster < wolfgang.schuster.lists@gmail.com> wrote:
Am 29.03.2025 um 16:22 schrieb Mohammad Hossein Bateni:
Hello,
Here's a MNWE:
------------------------------- \starttext \def\A{a} %\def\A{b} \ctxlua{LuaA("\doifelse{\A}{a}{ey}{bee}")} \stoptext -------------------------------
I put \expanded and \expandafter here and there, but couldn't get this to work.
Is the problem due to \doifelse scanning its input? If yes, how can we handle this?
Replace \doifelse with \expdoifelse or \expandeddoifelse.
Wolfgang
___________________________________________________________________________________ If your question is of interest to others as well, please add an entry to the Wiki!
maillist : ntg-context@ntg.nl / https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl webpage : https://www.pragma-ade.nl / https://context.aanhet.net (mirror) archive : https://github.com/contextgarden/context wiki : https://wiki.contextgarden.net
___________________________________________________________________________________
participants (3)
-
Mohammad Hossein Bateni
-
Rik Kabel
-
Wolfgang Schuster