From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.tex.context/63511 Path: news.gmane.org!not-for-mail From: Khaled Hosny Newsgroups: gmane.comp.tex.context Subject: Re: why nil argument Date: Sun, 14 Nov 2010 21:27:27 +0200 Message-ID: <20101114192727.GA21403@khaled-laptop> References: <2770E777-778C-49BC-86EF-52A65444E21C@uva.nl> Reply-To: mailing list for ConTeXt users NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Trace: dough.gmane.org 1289762875 10045 80.91.229.12 (14 Nov 2010 19:27:55 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Sun, 14 Nov 2010 19:27:55 +0000 (UTC) To: mailing list for ConTeXt users Original-X-From: ntg-context-bounces@ntg.nl Sun Nov 14 20:27:51 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 1PHiEw-0000kd-SO for gctc-ntg-context-518@m.gmane.org; Sun, 14 Nov 2010 20:27:50 +0100 Original-Received: from localhost (localhost [127.0.0.1]) by balder.ntg.nl (Postfix) with ESMTP id 3B3A8CA838; Sun, 14 Nov 2010 20:27:49 +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 asvOiavbz15z; Sun, 14 Nov 2010 20:27:46 +0100 (CET) Original-Received: from balder.ntg.nl (localhost [127.0.0.1]) by balder.ntg.nl (Postfix) with ESMTP id 39886CA831; Sun, 14 Nov 2010 20:27:46 +0100 (CET) Original-Received: from localhost (localhost [127.0.0.1]) by balder.ntg.nl (Postfix) with ESMTP id D513ECA831 for ; Sun, 14 Nov 2010 20:27:44 +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 qrB55fWDMb34 for ; Sun, 14 Nov 2010 20:27:41 +0100 (CET) Original-Received: from filter4-til.mf.surf.net (filter4-til.mf.surf.net [194.171.167.220]) by balder.ntg.nl (Postfix) with ESMTP id 66AE0CA824 for ; Sun, 14 Nov 2010 20:27:41 +0100 (CET) Original-Received: from mail-wy0-f169.google.com (mail-wy0-f169.google.com [74.125.82.169]) by filter4-til.mf.surf.net (8.14.3/8.14.3/Debian-5+lenny1) with ESMTP id oAEJRXKp003559 for ; Sun, 14 Nov 2010 20:27:34 +0100 Original-Received: by wyf23 with SMTP id 23so5073852wyf.14 for ; Sun, 14 Nov 2010 11:27:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:sender:date:from:to:subject :message-id:references:mime-version:content-type:content-disposition :in-reply-to:user-agent; bh=BTGUCHPbhCfJVWGcshCMSXTvuRIjb/TE7IYkF/92xNc=; b=WJtJkA7ola+NDuYAkBPCowF7yyNJdK4zbeK//mUrvpZPE8AL0AjOnGgNs7/XBctHg2 xlM1GGIU9OH1NHQpoCTz3+AWh2ulefF/FH/52WDGluSNHx88qbzDjkzYJpJy2F5ghs1+ 3QFXfs0KI5hG4C7dbqe51dF7IrWpJT0tY31Cg= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=sender:date:from:to:subject:message-id:references:mime-version :content-type:content-disposition:in-reply-to:user-agent; b=HZrK7ztegCdUxnAGfYrpQItikhPb6t5kQeAj6reZv06UIdLV7/EXjBIH8DCLsfD6ul 1XkqSOGNZKDhcu5rtSJXbzAsgDnnvW5vG09ZRZTuXfa91IYxW5uKt8apjllGUvPXkPJX dzoiMNPUYK1h05A9lxdVAIyNgrZKx4gkEb2cI= Original-Received: by 10.227.142.84 with SMTP id p20mr5148030wbu.182.1289762852608; Sun, 14 Nov 2010 11:27:32 -0800 (PST) Original-Received: from localhost ([41.238.234.163]) by mx.google.com with ESMTPS id x6sm3319285weq.37.2010.11.14.11.27.30 (version=TLSv1/SSLv3 cipher=RC4-MD5); Sun, 14 Nov 2010 11:27:31 -0800 (PST) Content-Disposition: inline In-Reply-To: <2770E777-778C-49BC-86EF-52A65444E21C@uva.nl> User-Agent: Mutt/1.5.20 (2009-06-14) X-Bayes-Prob: 0.0001 (Score 0, tokens from: @@RPTN) X-CanIt-Geo: ip=74.125.82.169; country=US; region=CA; city=Mountain View; postalcode=94043; latitude=37.4192; longitude=-122.0574; metrocode=807; areacode=650; http://maps.google.com/maps?q=37.4192,-122.0574&z=6 X-CanItPRO-Stream: uu:ntg-context@ntg.nl (inherits from uu:default, base:default) X-Canit-Stats-ID: 05Dv7rxFL - 54afed9f96a4 - 20101114 X-Scanned-By: CanIt (www . roaringpenguin . com) on 194.171.167.216 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:63511 Archived-At: 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") Regards, Khaled -- Khaled Hosny Arabic localiser and member of Arabeyes.org team Free font developer ___________________________________________________________________________________ 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 ___________________________________________________________________________________