[dev-context] \newconditional and Lua

Wolfgang Schuster schuster.wolfgang at googlemail.com
Tue Apr 26 16:08:23 CEST 2011


Hi Hans,

is there a simple way to change the status from commands created with \newconditional id \newif from, e.g. in the following example it’s easy to pass the value of the conditional from TeX to Lua but not in the reverse way.

\newconditional\test

\starttext

\settrue\test

TeX: \ifconditional\test TRUE\else FALSE\fi

Lua:
\startluacode
if \luaconditional\test then
	context("TRUE")
else
	context("FALSE")
end
\stopluacode

TeX: \ifconditional\test TRUE\else FALSE\fi

\stoptext

When i change \newconditional to \newcount it’s easy but not very elegant.

\newcount\test

\starttext

\settrue\test

TeX: \ifconditional\test TRUE\else FALSE\fi

Lua:
\startluacode
if \luaconditional\test then
	context("TRUE")
else
	context("FALSE")
end
tex.count['test'] = 1 ;
\stopluacode

TeX: \ifconditional\test TRUE\else FALSE\fi

\stoptext

Wolfgang




More information about the dev-context mailing list