From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.tex.context/82065 Path: news.gmane.org!not-for-mail From: luigi scarso Newsgroups: gmane.comp.tex.context Subject: Re: Accessing string contents of a macro in Lua. Date: Wed, 24 Apr 2013 18:50:19 +0200 Message-ID: References: Reply-To: mailing list for ConTeXt users NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1366822226 8782 80.91.229.3 (24 Apr 2013 16:50:26 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 24 Apr 2013 16:50:26 +0000 (UTC) To: mailing list for ConTeXt users Original-X-From: ntg-context-bounces@ntg.nl Wed Apr 24 18:50:30 2013 Return-path: Envelope-to: gctc-ntg-context-518@m.gmane.org Original-Received: from balder.ntg.nl ([195.12.62.10]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1UV2tp-0001pX-Uh for gctc-ntg-context-518@m.gmane.org; Wed, 24 Apr 2013 18:50:30 +0200 Original-Received: from localhost (localhost [127.0.0.1]) by balder.ntg.nl (Postfix) with ESMTP id A137D101EB; Wed, 24 Apr 2013 18:50:28 +0200 (CEST) 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 h1Sg+A-ltd1p; Wed, 24 Apr 2013 18:50:23 +0200 (CEST) Original-Received: from balder.ntg.nl (localhost [IPv6:::1]) by balder.ntg.nl (Postfix) with ESMTP id 5E49D101E4; Wed, 24 Apr 2013 18:50:23 +0200 (CEST) Original-Received: from localhost (localhost [127.0.0.1]) by balder.ntg.nl (Postfix) with ESMTP id 2A361101E4 for ; Wed, 24 Apr 2013 18:50:22 +0200 (CEST) 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 bqiVaU2gS52r for ; Wed, 24 Apr 2013 18:50:20 +0200 (CEST) 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 A867D101E3 for ; Wed, 24 Apr 2013 18:50:20 +0200 (CEST) Original-Received: from mail-la0-x22e.google.com (mail-la0-x22e.google.com [IPv6:2a00:1450:4010:c03::22e]) by filter4-til.mf.surf.net (8.14.3/8.14.3/Debian-9.4) with ESMTP id r3OGoJZu004634 for ; Wed, 24 Apr 2013 18:50:19 +0200 Original-Received: by mail-la0-f46.google.com with SMTP id ep20so1781757lab.5 for ; Wed, 24 Apr 2013 09:50:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:x-received:in-reply-to:references:date:message-id :subject:from:to:content-type; bh=dL/mg0FgoKa7mzcjNfwUAKCoxYmWBHjXR8hO6/0NFqw=; b=SamRQuzac2PS8DrdtP7QeacpD/oiyX8mqKbHkx5gd2+vbDWwSLPihxMV/TcFFT4bOW bXSbmqrkSatf05brqzy6bDIRZSA0dbEo0KnZJn+qz9uJR6arNDpomms835nmyaDAF2+8 5AngHZ5OZ12nNQLHRu7ddVAtn/8X7aOL3PvFTpxZHCRpaGsUTV3g+1JnyOzuIvICakNc waLLIjFDig6pklXteNMLqImarc/Zpj0uNN6sgCkC0N2xfhmVYwpnKdlVAEhnEbTNwjXb 3GBD8FlocCzE2f6WUDPuQud4lsYKBjxcQBjKoQ+FYNc86dpk+iSfc9vKQJTiyJkq8wTu 4GNw== X-Received: by 10.152.110.74 with SMTP id hy10mr18134236lab.37.1366822219218; Wed, 24 Apr 2013 09:50:19 -0700 (PDT) Original-Received: by 10.114.175.178 with HTTP; Wed, 24 Apr 2013 09:50:19 -0700 (PDT) In-Reply-To: X-Bayes-Prob: 0.0003 (Score 0, tokens from: @@RPTN) X-CanIt-Geo: ip=2a00:1450:4010:c03::22e; country=IE X-CanItPRO-Stream: uu:ntg-context@ntg.nl (inherits from uu:default, base:default) X-Canit-Stats-ID: 0VJrQOjKE - 695c190d3343 - 20130424 (trained as not-spam) X-Scanned-By: CanIt (www . roaringpenguin . com) X-BeenThere: ntg-context@ntg.nl X-Mailman-Version: 2.1.14 Precedence: list List-Id: mailing list for ConTeXt users List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: ntg-context-bounces@ntg.nl Original-Sender: ntg-context-bounces@ntg.nl Xref: news.gmane.org gmane.comp.tex.context:82065 Archived-At: On Wed, Apr 24, 2013 at 5:51 PM, Sietse Brouwer wrote: > Hi all, > > Below are three methods of defining a dimension / dimension string in > ConTeXt --- the first two boil down to storing a string in a macro, > the last is a proper TeX dimen. I want to access these dimensions from > Lua. > > I can access the dimen via tex.dimen.ColumnC, but how can I access the > macro contents? > If there is no solution, I can always explicitly pass the value to Lua with > > \ctxlua{var = '\measure{ColumnA}'} > > , but I want to know if there is a Lua-only method to get these values. > > %% MWE > \definemeasure[ColumnA][10mm] > > \def\ColumnB{20mm} not a general solution %%% \def\ColumnB{20mm} \starttext \startluacode local c = "\\csname ColumnB\\endcsname" context("ColumnB=%s",c) \stopluacode \par \toks0=\expandafter{\ColumnB} \startluacode context("ColumnB=%s",tex.toks[0]) \stopluacode \stoptext -- luigi ___________________________________________________________________________________ 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 ___________________________________________________________________________________