From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.tex.context/64873 Path: news.gmane.org!not-for-mail From: Wolfgang Schuster Newsgroups: gmane.comp.tex.context Subject: Re: Escaping in LuaTeX Date: Sun, 2 Jan 2011 09:30:43 +0100 Message-ID: References: <201101020205.04285.Yota_VGA@tiscali.it> 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="windows-1252" Content-Transfer-Encoding: quoted-printable X-Trace: dough.gmane.org 1293957369 30156 80.91.229.12 (2 Jan 2011 08:36:09 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Sun, 2 Jan 2011 08:36:09 +0000 (UTC) To: mailing list for ConTeXt users Original-X-From: ntg-context-bounces@ntg.nl Sun Jan 02 09:36:05 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 1PZJQ3-0008Rs-6d for gctc-ntg-context-518@m.gmane.org; Sun, 02 Jan 2011 09:36:03 +0100 Original-Received: from localhost (localhost [127.0.0.1]) by balder.ntg.nl (Postfix) with ESMTP id 2AD5FCA980; Sun, 2 Jan 2011 09:36:02 +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 tsQUQB8Bm6uH; Sun, 2 Jan 2011 09:35:58 +0100 (CET) Original-Received: from balder.ntg.nl (localhost [127.0.0.1]) by balder.ntg.nl (Postfix) with ESMTP id B6F8CCA978; Sun, 2 Jan 2011 09:35:58 +0100 (CET) Original-Received: from localhost (localhost [127.0.0.1]) by balder.ntg.nl (Postfix) with ESMTP id 6DFF3CA978 for ; Sun, 2 Jan 2011 09:35:57 +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 Nh8fEi1RXhdf for ; Sun, 2 Jan 2011 09:35:45 +0100 (CET) Original-Received: from filter3-til.mf.surf.net (filter3-til.mf.surf.net [194.171.167.219]) by balder.ntg.nl (Postfix) with ESMTP id 9AE7FCA977 for ; Sun, 2 Jan 2011 09:35:45 +0100 (CET) Original-Received: from mail-bw0-f41.google.com (mail-bw0-f41.google.com [209.85.214.41]) by filter3-til.mf.surf.net (8.14.3/8.14.3/Debian-5+lenny1) with ESMTP id p028Zidp000905 for ; Sun, 2 Jan 2011 09:35:45 +0100 Original-Received: by bwz16 with SMTP id 16so13978678bwz.14 for ; Sun, 02 Jan 2011 00:35:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=gamma; h=domainkey-signature:received:received:subject:mime-version :content-type:from:in-reply-to:date:cc:content-transfer-encoding :message-id:references:to:x-mailer; bh=E5LWFln4+cYAmEz0mqb+h5e8g9wHsgumBfsw5WegC4o=; b=J1bxnFBqqv7SpYPGYgep6yboBo+WTtxD7DjY2sLJrNFjEaRSv7oiG/pJehPYO0GMYV P0jHK+7kwqhKfHPmk5dbD4uhILv53SrUblBKfc2Y9QmDFVpwoMOPZD5D3YlVIMBWsq1P jGoM66cSqGLW1XcrYaGd6Q8JzFpHerpFzefcM= DomainKey-Signature: a=rsa-sha1; c=nofws; d=googlemail.com; s=gamma; h=subject:mime-version:content-type:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to:x-mailer; b=uiRdbSEu4NvZ+UL2IHDxXxlSCfdR/+BVH80UXs1vxm6mUUK7cWr137z9UAgUvGUK4V UNKMgrs1AXVCaUO0b9iRHTlqi1x7+SorQ92DeWH2WtUtAggYFxNM1zlI791HYdULZbRc 6J8ZR1RznoPSSpz/oTSv8Wd8RqPdYN3DBMJDY= Original-Received: by 10.204.71.141 with SMTP id h13mr2932125bkj.180.1293957344048; Sun, 02 Jan 2011 00:35:44 -0800 (PST) Original-Received: from [192.168.2.23] (p5B295656.dip.t-dialin.net [91.41.86.86]) by mx.google.com with ESMTPS id x38sm9472987bkj.13.2011.01.02.00.35.37 (version=TLSv1/SSLv3 cipher=RC4-MD5); Sun, 02 Jan 2011 00:35:42 -0800 (PST) In-Reply-To: <201101020205.04285.Yota_VGA@tiscali.it> X-Mailer: Apple Mail (2.1082) X-Bayes-Prob: 0.5 (Score 0, tokens from: ) X-CanIt-Geo: ip=209.85.214.41; 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: 0eDOwzI0T - b2459276d076 - 20110102 X-Scanned-By: CanIt (www . roaringpenguin . com) on 194.171.167.219 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:64873 Archived-At: Am 02.01.2011 um 02:04 schrieb Fulvio Satta: > I have a problem with Lua and the "#" operator. > If I execute the following code I receive an error. > = > \def\luacode% > {\startluacode > local t =3D {1, 2, 3} > tex.print(#t) > \stopluacode} > = > \starttext > \luacode > \stoptext > = > ConTeXt give me the message: > = > ! Illegal parameter number in definition of \luacode. > = > t > l.4 tex.print(#t > ) > = > And if I execute the "H" command I get: > = > You meant to type ## instead of #, right? > Or maybe a } was forgotten somewhere earlier, and things > are all screwed up? I''m going to assume that you meant ##. > = > I've tryed with ##t, whit \#t, with \string#t, with \ctxlua instread of = > \startluacode and \stopluacode, and I've obtained some other errors, but = > ConTeXt always give me an error. > = > Maybe should I escape in another manner the "#" operator? You can replace the # with \letterhash but you method is wrong, the first t= hing is that \luacode is already defined in the core and it can be used as replacement f= or \ctxlua and second it=92s better to separate a lua function and the call to the fun= ction. Instead of writing the function in a luacode environment you can also put it in a external file which is then loaded in your document/module. You should also use a namespace for your functions. \startluacode userdata =3D userdata or { } userdata.fulvio =3D userdata.fulvio or { } function userdata.fulvio.size() local t =3D {1, 2, 3} tex.print(#t) end \stopluacode \def\SizeOne{\ctxlua {userdata.fulvio.size()}} \def\SizeTwo{\luacode{userdata.fulvio.size()}} \starttext \startluacode local t =3D {1, 2, 3} tex.print(#t) \stopluacode \starttabulate \NC ctxlua \EQ \SizeOne \NC\NR \NC luacode \EQ \SizeTwo \NC\NR \stoptabulate \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 ___________________________________________________________________________= ________