From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.tex.context/63512 Path: news.gmane.org!not-for-mail From: Hans van der Meer Newsgroups: gmane.comp.tex.context Subject: Re: why nil argument Date: Sun, 14 Nov 2010 20:47:30 +0100 Message-ID: References: <2770E777-778C-49BC-86EF-52A65444E21C@uva.nl> <20101114192727.GA21403@khaled-laptop> Reply-To: mailing list for ConTeXt users NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 (Apple Message framework v1082) Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Trace: dough.gmane.org 1289764072 15164 80.91.229.12 (14 Nov 2010 19:47:52 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Sun, 14 Nov 2010 19:47:52 +0000 (UTC) To: mailing list for ConTeXt users Original-X-From: ntg-context-bounces@ntg.nl Sun Nov 14 20:47:44 2010 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 1PHiYA-0003H5-4G for gctc-ntg-context-518@m.gmane.org; Sun, 14 Nov 2010 20:47:42 +0100 Original-Received: from localhost (localhost [127.0.0.1]) by balder.ntg.nl (Postfix) with ESMTP id 4EC39CA83C; Sun, 14 Nov 2010 20:47:41 +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 Z2gVJNbtX7Mb; Sun, 14 Nov 2010 20:47:37 +0100 (CET) Original-Received: from balder.ntg.nl (localhost [127.0.0.1]) by balder.ntg.nl (Postfix) with ESMTP id 2342DCA831; Sun, 14 Nov 2010 20:47:37 +0100 (CET) Original-Received: from localhost (localhost [127.0.0.1]) by balder.ntg.nl (Postfix) with ESMTP id 433B3CA831 for ; Sun, 14 Nov 2010 20:47:35 +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 AnRrueaXSWqJ for ; Sun, 14 Nov 2010 20:47:32 +0100 (CET) Original-Received: from filter5-til.mf.surf.net (filter5-til.mf.surf.net [194.171.167.221]) by balder.ntg.nl (Postfix) with ESMTP id A57F7CA824 for ; Sun, 14 Nov 2010 20:47:32 +0100 (CET) Original-Received: from postduif.ic.uva.nl (postduif.ic.uva.nl [145.18.40.180]) by filter5-til.mf.surf.net (8.14.3/8.14.3/Debian-5+lenny1) with ESMTP id oAEJlVhw003996 for ; Sun, 14 Nov 2010 20:47:32 +0100 Original-Received: from elhalyn.fritz.box (a82-95-102-36.adsl.xs4all.nl [82.95.102.36]) (authenticated bits=0) by postduif.ic.uva.nl (8.13.1/8.13.1) with ESMTP id oAEJlU4A018605 (version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=NO) for ; Sun, 14 Nov 2010 20:47:31 +0100 In-Reply-To: <20101114192727.GA21403@khaled-laptop> X-Mailer: Apple Mail (2.1082) X-CanIt-Geo: ip=145.18.40.180; country=NL; region=07; city=Amsterdam; latitude=52.3500; longitude=4.9167; http://maps.google.com/maps?q=52.3500,4.9167&z=6 X-CanItPRO-Stream: uu:ntg-context@ntg.nl (inherits from uu:default, base:default) X-Canit-Stats-ID: 0xDv7LvGI - 158781f6325d - 20101114 X-Scanned-By: CanIt (www . roaringpenguin . com) on 194.171.167.221 X-Scanned-By: CanIt (www . roaringpenguin . com) on 145.18.40.180 X-Bayes-Prob: 0.0001 (Score 0, tokens from: @@RPTN) 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:63512 Archived-At: On 14 nov 2010, at 20:27, Khaled Hosny wrote: > On Sun, Nov 14, 2010 at 06:55:20PM +0100, Hans van der Meer wrote: >> In transforming dates through a Lua-call I get a nil error I do not understand. >> >> The luatex code = >> \startluacode >> hvdm = hvdm or {} >> require "lpeg" >> -- Transform date in Lua from yyyymmdd to dd-mm-yyyy with checks >> hvdm.day = lpeg.R("02") * lpeg.R("09") + lpeg.P("30") + lpeg.P("31") - lpeg.P("00") >> hvdm.month = lpeg.P("0") * lpeg.R("19") + lpeg.P("10") + lpeg.P("11") + lpeg.P("12") >> hvdm.year = lpeg.R("12") * lpeg.R("09") * lpeg.R("09") * lpeg.R("09") >> hvdm.date = lpeg.C(hvdm.year) * lpeg.C(hvdm.month) * lpeg.C(hvdm.day) * -1 / "%3-%2-%1" >> \stopluacode >> \def\FormatDate#1{\ctxlua{tex.print(tostring(hvdm.date:match(#1)))}} >> >> Calling \FormatDate(1) is OK although it returns "nil" (correct would be #1 = 20101114 >> Calling \FormatDate(A) is not OK with the error: > > You are passing a undefined variable, A. Your argument should be quoted: > > hvdm.date:match("#1") > I would think that is not the case. For one, because then calling with argument 1 would fail in the same manner as argument A does; which does not happen. Secondly, the call originates from \startxmlsetups xml:case:burned \xmldoifelsetext{#1}{}{\FormatDate{\xmlflush{#1}}}{\currentdate} \stopxmlsetups This does makes it a string already. Something else must happen here, I guess. Hans van der Meer ___________________________________________________________________________________ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / 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 ___________________________________________________________________________________