Received: from mout.gmx.net (mout.gmx.net [212.227.15.19]) by h1439878.stratoserver.net (8.14.2/8.14.2/Debian-2build1) with ESMTP id s7JHNlVh007309 for ; Tue, 19 Aug 2014 19:23:48 +0200 Received: from relay2.uni-heidelberg.de ([129.206.210.211]) by mx-ha.gmx.net (mxgmx004) with ESMTPS (Nemesis) id 0LfYNN-1WZE6m1hfd-00p2Dh for ; Tue, 19 Aug 2014 19:23:41 +0200 Received: from listserv.uni-heidelberg.de (listserv.uni-heidelberg.de [129.206.100.94]) by relay2.uni-heidelberg.de (8.13.8/8.13.8) with ESMTP id s7JHLJ8x011369 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Tue, 19 Aug 2014 19:21:19 +0200 Received: from listserv.uni-heidelberg.de (listserv.uni-heidelberg.de [127.0.0.1]) by listserv.uni-heidelberg.de (8.13.8/8.13.8) with ESMTP id s7JAb9GZ020463; Tue, 19 Aug 2014 19:21:19 +0200 Received: by LISTSERV.UNI-HEIDELBERG.DE (LISTSERV-TCP/IP release 16.0) with spool id 11302268 for LATEX-L@LISTSERV.UNI-HEIDELBERG.DE; Tue, 19 Aug 2014 19:21:19 +0200 Received: from relay.uni-heidelberg.de (relay.uni-heidelberg.de [129.206.100.212]) by listserv.uni-heidelberg.de (8.13.8/8.13.8) with ESMTP id s7JHLIf7031040 for ; Tue, 19 Aug 2014 19:21:18 +0200 Received: from mail-lb0-f171.google.com (mail-lb0-f171.google.com [209.85.217.171]) by relay.uni-heidelberg.de (8.14.1/8.14.1) with ESMTP id s7JHL4Ce027292 (version=TLSv1/SSLv3 cipher=RC4-SHA bits=128 verify=FAIL) for ; Tue, 19 Aug 2014 19:21:06 +0200 Received: by mail-lb0-f171.google.com with SMTP id l4so5750473lbv.2 for ; Tue, 19 Aug 2014 10:21:04 -0700 (PDT) X-Received: by 10.112.35.44 with SMTP id e12mr35036020lbj.13.1408468863951; Tue, 19 Aug 2014 10:21:03 -0700 (PDT) Received: from mellon.site (p54806215.dip0.t-ipconnect.de. [84.128.98.21]) by mx.google.com with ESMTPSA id x5sm4280664lad.29.2014.08.19.10.21.02 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 19 Aug 2014 10:21:03 -0700 (PDT) User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.7.0 MIME-Version: 1.0 References: <53F382C3.30901@arcor.de> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Message-ID: <53F3877C.2070304@googlemail.com> Date: Tue, 19 Aug 2014 19:21:00 +0200 Reply-To: Mailing list for the LaTeX3 project Sender: Mailing list for the LaTeX3 project From: Heiko Oberdiek Subject: Re: \directlua in LaTeX3 To: LATEX-L@LISTSERV.UNI-HEIDELBERG.DE In-Reply-To: <53F382C3.30901@arcor.de> Precedence: list List-Help: , List-Unsubscribe: List-Subscribe: List-Owner: List-Archive: Envelope-To: X-GMX-Antispam: 0 (Mail was not recognized as spam); Detail=V3; X-GMX-Antivirus: 0 (no virus found) X-UI-Filterresults: notjunk:1;V01:K0:sN80WwcT3j8=:oUWAOAert6hihc8r6hCItTE2DP YZkctjX6BikzHPXLcUipNP3OPLVjOQB+pWokoorqlkwoGii7uzRPQpNY5733Yw5ml+FDPKflR s2cpFKfKdYkVx558GMQsgmUJUnOQpvWVczB1nNmNslYeYlbyaMp42lSiInc5hf2iA08TQDIyd w2UZxGvlS9zeiGbv3xP1eeaSHJvliWD6E1adU9Ufdv6xBuqio9T5WvkprxyAfYMRlfErN/NFA wqSq5CADnbWxx/ecxfr5pbkCf2S0stfqjFW7ZfsaJ00MQMgTlPuuAF0oru0rRnEvD9HO9JwaC mbi+zWTzgBiGg+7FkBTCFX+z8ZT4fyszEdboDqkmljO6/66cNYJzon62h0K2K/8PS+k1srFx4 5L3I1HOfZTN+FI/nH2qw8T4Quett0kYL2Pvxf+OU7JAHwzJ6lUByF8cihYW3xu2CpZP9zPC/l n+SSx14CTDwDmk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LmrA= = X-UI-Loop:V01:/P1o3LoHaTk=:lS8BJ+4Dk7UMuETP79wDsf/UM5pEt5C2esnMlFvH+9w= X-UI-Out-Filterresults: notjunk:1; Status: R X-Status: X-Keywords: X-UID: 7561 On 19.08.2014 19:00, Stephan Hennig wrote: > Hi, > > I'm observing differences in the handling of \directlua between LaTeX2e > and LaTeX3 (in LaTeX2e). Compiling this example > > \listfiles > \documentclass{article} > \usepackage{expl3} > \newcommand*{\mymacro}{Hello World!} > \directlua{ > local myarg = '\mymacro' > texio.write_nl('l2: argument is ' .. tostring(myarg)) > } > \ExplSyntaxOn > \directlua{ > local myarg = '\mymacro' > texio.write_nl('l3: argument is ' .. tostring(myarg)) > } > \ExplSyntaxOff > \begin{document} > \end{document} > > with lualatex, the output is > > l2: argument is Hello World! > l3:argumentisnil > > First, spaces are gone in Lua code. Though, spaces are significant in Lua. `\ExplSyntaxOn' says that spaces are gone, that's the purpose of this command. Explicit spaces are available via `~': \directlua{ local~myarg = '\mymacro' texio.write_nl('l3:~argument~is~' .. tostring(myarg)) } > Second, variable myarg is nil with \ExplSyntaxOn. (I don't understand why.) Without spaces you get: localmyarg='\mymacro' This defines "localmyarg" globally instead of "myarg". BTW, this is quite a risky way to pass the contents of user variables ot Lua code. Consider syntax errors, if "\mymacro" contains ', or "\mymacro" could even contain containing something like: '; very evil code; local dummy=' There is \luaescapestring/\luatexluaescapestring: '\luatexluaescapestring{\mymacro}' Yours sincerely Heiko Oberdiek