Am 25.03.2011 um 13:04 schrieb Procházka Lukáš Ing. - Pontex s. r. o.:

> Hello,
> 
> is it possible to use a block of context code depending on a value of a Lua 
> variable?
> 
> I tried something like:
> 
> ---
> \starttext
>  \directlua{test = true}
>  %\directlua{test = 5}
>  %\directlua{test = "a"}
> 
>  \doifempty{\directlua{return test}}
>  %\doifempty{\directlua{test}}
>    {Yes}
>    {No}
> \stoptext
> ---
> 
> But this gives me always "No".
> 
> - I'm not sure if this is a good way, and whether attempt to use \doif(...) 
> macro is a good idea at all.
> 
> Any (better) solution?


\starttext

\ctxlua{test = true}

Test is \ctxlua{commands.testcase(test)}{True}{False}.

\ctxlua{test = false}

Test is \ctxlua{commands.testcase(test)}{True}{False}.

\stoptext

Wolfgang

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

maillist : [email protected] / 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
___________________________________________________________________________________

Reply via email to