From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.tex.context/67381 Path: news.gmane.org!not-for-mail From: =?iso-8859-2?B?UHJvY2jhemthIEx1a+G5IEluZy4gLSBQb250ZXggcy4gci4gby4=?= Newsgroups: gmane.comp.tex.context Subject: Re: \doif... and Lua Date: Fri, 25 Mar 2011 14:24:17 +0100 Message-ID: References: <56EE34D2-65AD-4DA5-A849-A635B65652E6@googlemail.com> Reply-To: mailing list for ConTeXt users NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-2"; Format="flowed"; DelSp="yes" Content-Transfer-Encoding: quoted-printable X-Trace: dough.gmane.org 1301059487 17924 80.91.229.12 (25 Mar 2011 13:24:47 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Fri, 25 Mar 2011 13:24:47 +0000 (UTC) To: "mailing list for ConTeXt users" Original-X-From: ntg-context-bounces@ntg.nl Fri Mar 25 14:24:43 2011 Return-path: Envelope-to: gctc-ntg-context-518@m.gmane.org Original-Received: from balder.ntg.nl ([195.12.62.10]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1Q370L-0003AK-NJ for gctc-ntg-context-518@m.gmane.org; Fri, 25 Mar 2011 14:24:41 +0100 Original-Received: from localhost (localhost [127.0.0.1]) by balder.ntg.nl (Postfix) with ESMTP id A7A2CCAB59; Fri, 25 Mar 2011 14:24:24 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at balder.ntg.nl Original-Received: from balder.ntg.nl ([127.0.0.1]) by localhost (balder.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with LMTP id qsfXUiDKRj79; Fri, 25 Mar 2011 14:24:22 +0100 (CET) Original-Received: from balder.ntg.nl (localhost [127.0.0.1]) by balder.ntg.nl (Postfix) with ESMTP id 377AFCAB4F; Fri, 25 Mar 2011 14:24:22 +0100 (CET) Original-Received: from localhost (localhost [127.0.0.1]) by balder.ntg.nl (Postfix) with ESMTP id 86BCFCAB4F for ; Fri, 25 Mar 2011 14:24:20 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at balder.ntg.nl Original-Received: from balder.ntg.nl ([127.0.0.1]) by localhost (balder.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with LMTP id kgldi7b3RHXI for ; Fri, 25 Mar 2011 14:24:07 +0100 (CET) Original-Received: from filter4-nij.mf.surf.net (filter4-nij.mf.surf.net [195.169.124.155]) by balder.ntg.nl (Postfix) with ESMTP id 45947CAB49 for ; Fri, 25 Mar 2011 14:24:07 +0100 (CET) Original-Received: from mail.pontex.cz (mail.pontex.cz [89.233.168.98]) by filter4-nij.mf.surf.net (8.14.3/8.14.3/Debian-5+lenny1) with ESMTP id p2PDOLOk012991 for ; Fri, 25 Mar 2011 14:24:22 +0100 Original-Received: from localhost ([127.0.0.1]) by mail.pontex.cz (Kerio MailServer 6.6.2) for ntg-context@ntg.nl; Fri, 25 Mar 2011 14:24:19 +0100 In-Reply-To: <56EE34D2-65AD-4DA5-A849-A635B65652E6@googlemail.com> User-Agent: Opera Mail/11.01 (Win32) X-Bayes-Prob: 0.0001 (Score 0, tokens from: @@RPTN) X-CanIt-Geo: ip=89.233.168.98; country=CZ; region=52; city=Prague; latitude=50.0833; longitude=14.4667; http://maps.google.com/maps?q=50.0833,14.4667&z=6 X-CanItPRO-Stream: uu:ntg-context@ntg.nl (inherits from uu:default, base:default) X-Canit-Stats-ID: 04EnpomvF - 2655e733aabe - 20110325 X-Scanned-By: CanIt (www . roaringpenguin . com) on 195.169.124.155 X-BeenThere: ntg-context@ntg.nl X-Mailman-Version: 2.1.12 Precedence: list List-Id: mailing list for ConTeXt users List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: ntg-context-bounces@ntg.nl Errors-To: ntg-context-bounces@ntg.nl Xref: news.gmane.org gmane.comp.tex.context:67381 Archived-At: Perfect, thanks. Lukas On Fri, 25 Mar 2011 13:25:52 +0100, Wolfgang Schuster wrote: > > Am 25.03.2011 um 13:04 schrieb Proch=E1zka Luk=E1=B9 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 =3D true} >> %\directlua{test =3D 5} >> %\directlua{test =3D "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 =3D true} > > Test is \ctxlua{commands.testcase(test)}{True}{False}. > > \ctxlua{test =3D 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 t= he Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-cont= ext webpage : http://www.pragma-ade.nl / http://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___________________________________________________________________________= ________