From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.tex.context/82064 Path: news.gmane.org!not-for-mail From: Sietse Brouwer Newsgroups: gmane.comp.tex.context Subject: Accessing string contents of a macro in Lua. Date: Wed, 24 Apr 2013 17:51:54 +0200 Message-ID: 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 1366818750 22191 80.91.229.3 (24 Apr 2013 15:52:30 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 24 Apr 2013 15:52:30 +0000 (UTC) To: mailing list for ConTeXt users Original-X-From: ntg-context-bounces@ntg.nl Wed Apr 24 17:52:34 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 1UV1zl-0006nv-JU for gctc-ntg-context-518@m.gmane.org; Wed, 24 Apr 2013 17:52:33 +0200 Original-Received: from localhost (localhost [127.0.0.1]) by balder.ntg.nl (Postfix) with ESMTP id E40AC101E3; Wed, 24 Apr 2013 17:52:32 +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 4vOVQV44QOJs; Wed, 24 Apr 2013 17:52:27 +0200 (CEST) Original-Received: from balder.ntg.nl (localhost [IPv6:::1]) by balder.ntg.nl (Postfix) with ESMTP id 7AA4A101E4; Wed, 24 Apr 2013 17:52:27 +0200 (CEST) Original-Received: from localhost (localhost [127.0.0.1]) by balder.ntg.nl (Postfix) with ESMTP id 0984B101E4 for ; Wed, 24 Apr 2013 17:52:26 +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 QkzHLNONg86C for ; Wed, 24 Apr 2013 17:52:25 +0200 (CEST) Original-Received: from filter2-ams.mf.surf.net (filter2-ams.mf.surf.net [192.87.102.70]) by balder.ntg.nl (Postfix) with ESMTP id 169F1101E3 for ; Wed, 24 Apr 2013 17:52:25 +0200 (CEST) Original-Received: from mail-ee0-f49.google.com (mail-ee0-f49.google.com [74.125.83.49]) by filter2-ams.mf.surf.net (8.14.3/8.14.3/Debian-9.4) with ESMTP id r3OFqOrm005476 for ; Wed, 24 Apr 2013 17:52:24 +0200 Original-Received: by mail-ee0-f49.google.com with SMTP id d4so819321eek.36 for ; Wed, 24 Apr 2013 08:52:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:mime-version:from:date:message-id:subject:to :content-type; bh=grVVC7JVG8PCbY8qXsxkuu8BFvPjNph0TJrS/Q8skwo=; b=wGrgJxHscAKq3Cwa4Tjn9UxIFbRct2jON6NuBoH9Z/1s5/q1Magc82BRo1PzMDE99f BCIkg/iqMTinmS0qXo89MgHDonKSGTGIqDV2xBYf/JwqUUImiNy/sGz5EgE9Y2kElb+H SAZU6+hz2Q/Di6QOvZKujV2ArxC62SJypQ2S+HUEaHyOBE80UXxbEmFjactYoeePu71o RUw172G/BvmMJWxZs0H/rAyGocdHiPfNyj6MdyvXdZboeZeb8Vf3ftTKLpX6uVrtpfNB 7hO6Ki0fJRqNHDlqBtJPtrTFAAgfdJ5rmHTRQZEYTFk1Xc9ceTxAm/0atWKziMa0TW02 TZBA== X-Received: by 10.14.87.199 with SMTP id y47mr65101740eee.17.1366818744446; Wed, 24 Apr 2013 08:52:24 -0700 (PDT) Original-Received: by 10.15.110.3 with HTTP; Wed, 24 Apr 2013 08:51:54 -0700 (PDT) X-Bayes-Prob: 0.0005 (Score 0, tokens from: @@RPTN) X-CanIt-Geo: ip=74.125.83.49; 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: 0QJrPQoAP - 077cb4fb1a48 - 20130424 (trained as not-spam) X-Scanned-By: CanIt (www . roaringpenguin . com) on 192.87.102.70 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:82064 Archived-At: 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} \newdimen\ColumnC \ColumnC=30mm \startluacode -- print values to stdout logs.report('====') logs.report('ColumnA', context.measure('ColumnA')) logs.report('ColumnB', context.ColumnB) logs.report('ColumnC', tex.dimen.ColumnC) -- prints in scaled points print('====') \stopluacode Cheers, Sietse ___________________________________________________________________________________ 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 ___________________________________________________________________________________