Received: from mout.gmx.net (mout.gmx.net [212.227.17.21]) by h1439878.stratoserver.net (8.14.2/8.14.2/Debian-2build1) with ESMTP id s7JK1o97007971 for ; Tue, 19 Aug 2014 22:01:51 +0200 Received: from relay2.uni-heidelberg.de ([129.206.210.211]) by mx-ha.gmx.net (mxgmx110) with ESMTPS (Nemesis) id 0LsPTg-1WMK9I3IRk-0121KT for ; Tue, 19 Aug 2014 22:01:44 +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 s7JJxCW8001707 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Tue, 19 Aug 2014 21:59:12 +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 s7JJ458x007902; Tue, 19 Aug 2014 21:59:12 +0200 Received: by LISTSERV.UNI-HEIDELBERG.DE (LISTSERV-TCP/IP release 16.0) with spool id 11308615 for LATEX-L@LISTSERV.UNI-HEIDELBERG.DE; Tue, 19 Aug 2014 21:59:12 +0200 Received: from relay2.uni-heidelberg.de (relay2.uni-heidelberg.de [129.206.210.211]) by listserv.uni-heidelberg.de (8.13.8/8.13.8) with ESMTP id s7JJxCEG001412 for ; Tue, 19 Aug 2014 21:59:12 +0200 Received: from mail-qa0-f46.google.com (mail-qa0-f46.google.com [209.85.216.46]) by relay2.uni-heidelberg.de (8.13.8/8.13.8) with ESMTP id s7JJwVGG001393 (version=TLSv1/SSLv3 cipher=RC4-SHA bits=128 verify=FAIL) for ; Tue, 19 Aug 2014 21:58:35 +0200 Received: by mail-qa0-f46.google.com with SMTP id v10so6023455qac.33 for ; Tue, 19 Aug 2014 12:58:29 -0700 (PDT) MIME-Version: 1.0 X-Received: by 10.224.122.83 with SMTP id k19mr66684591qar.78.1408478308994; Tue, 19 Aug 2014 12:58:28 -0700 (PDT) Received: by 10.96.131.78 with HTTP; Tue, 19 Aug 2014 12:58:28 -0700 (PDT) References: <53F382C3.30901@arcor.de> <53F3877C.2070304@googlemail.com> <53F3931A.4080203@arcor.de> Content-Type: text/plain; charset=UTF-8 Message-ID: Date: Tue, 19 Aug 2014 21:58:28 +0200 Reply-To: Mailing list for the LaTeX3 project Sender: Mailing list for the LaTeX3 project From: Bruno Le Floch Subject: Re: \directlua in LaTeX3 To: LATEX-L@LISTSERV.UNI-HEIDELBERG.DE In-Reply-To: <53F3931A.4080203@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:tBw8omEAwaU=:7A80TrT1A2ByFVMl/C1ppGrlkc q4tVbs9QOqXMf49yhOg03NeouBKkbg3h3QEKAsJt4AYTsHV5p20PZd5Ofwwd59LGoTlb8g+kg y7XClbBbClqrEv4ikkasi3RyuD1KOQUpmg7v5VFNxmxtpPSgAxUpdlTbm7BNurWIxg+QxMWG0 yyBT/eYTD1SYd7AVNWinBiVwkcX0s+3dPyz5HdvraBQ5ryYGW+ZGWDM7i/3C034wN+qUv6j4T 6pz0ieLRDleTHGWztefgs/yP5JnZZAWyiTFrRsvWOtpqh9W/+7L8qXvig8NfshltleQHvYvk5 YNXv7susP2IZFnHXJhs2jw9kSexHXNzcME6NuFBgpbV9vxSe7w+KMq8h7Ax/s7THTDUm2cEx5 oVLzt5DjSFJxNjB2h7O0fSeRCvoRL/OH5MkstYcEsE63+cMKDC1Ha9M1O9PvYRZYC4vFFfhBr UdELpzaYzOMmQbrg8qqybOS1RthQoKj8IJVtm2x81CI/WUzopHXZFIkuMbPPz95WU0RnoswFr evX0pBmEJemq4JhBc27Fic9+RjDvFSjs0pbsgH4cIFyc0wCSgEY9ZAnLSTzkumt8EisldKktF Ulrk7K2Er21H2rkud24/Csm8K4M/YSnzyK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2014 um 19:21 schrieb Heiko Oberdiek: > >>> \ExplSyntaxOn >>> \directlua{ >>> local myarg = '\mymacro' >>> texio.write_nl('l3: argument is ' .. tostring(myarg)) >>> } >>> [...] >>> 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 `~': > > Have already seen that when using l3's message mechanism, but didn't try > in \directlua. Thanks! > > >>> Second, variable myarg is nil with \ExplSyntaxOn. (I don't understand >>> why.) >> >> Without spaces you get: >> >> localmyarg='\mymacro' > > Should have seen that by myself. Thanks again! > > >> 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}' > > It's actually a language string that I'm evaluating to a number via > > \the\csname l@#1\endcsname or > \int_use:N\cs:w l@#1\cs_end: in LaTeX3 > > If #1 contains no valid language identifier, the expression should throw > an error. So, I think I'm safe here. I'm indeed using \luaescapestring > in other circumstances. > > Thanks! > Stephan Hennig Avoid using \cs:w ... \cs_end: constructions. It is much better to use a c-type argument, so for your case, \int_use:c { l@#1 }. Regards, Bruno