From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.tex.context/70064 Path: news.gmane.org!not-for-mail From: Jaroslav Hajtmar Newsgroups: gmane.comp.tex.context Subject: =?utf-8?b?RmluZGluZyB2YWx1ZXMg4oCL4oCLb2YgdGhlIGNv?= =?utf-8?q?ntext_macros_inside_Lua_functions_=28=3Dexpansion_inside_Lua_fu?= =?utf-8?b?bmN0aW9ucz8p?= Date: Sun, 17 Jul 2011 14:01:37 +0200 Message-ID: <4E22CF21.9060603@gyza.cz> Reply-To: hajtmar@gyza.cz, mailing list for ConTeXt users NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii"; Format="flowed" Content-Transfer-Encoding: 7bit X-Trace: dough.gmane.org 1310904132 26252 80.91.229.12 (17 Jul 2011 12:02:12 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Sun, 17 Jul 2011 12:02:12 +0000 (UTC) To: mailing list for ConTeXt users Original-X-From: ntg-context-bounces@ntg.nl Sun Jul 17 14:02: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 1QiQ2u-0005Is-Ck for gctc-ntg-context-518@m.gmane.org; Sun, 17 Jul 2011 14:02:04 +0200 Original-Received: from localhost (localhost [127.0.0.1]) by balder.ntg.nl (Postfix) with ESMTP id 2D1E3CAE5F; Sun, 17 Jul 2011 14:02:03 +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 a2yYnv1BzBxR; Sun, 17 Jul 2011 14:01:57 +0200 (CEST) Original-Received: from balder.ntg.nl (localhost [127.0.0.1]) by balder.ntg.nl (Postfix) with ESMTP id A3E16CAE55; Sun, 17 Jul 2011 14:01:57 +0200 (CEST) Original-Received: from localhost (localhost [127.0.0.1]) by balder.ntg.nl (Postfix) with ESMTP id B6E81CAE55 for ; Sun, 17 Jul 2011 14:01:56 +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 5ivNzp1rfwHU for ; Sun, 17 Jul 2011 14:01:45 +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 DDC5FCAE51 for ; Sun, 17 Jul 2011 14:01:45 +0200 (CEST) Original-Received: from psi1.forpsi.com (smtpa.forpsi.com [81.2.195.204]) by filter4-til.mf.surf.net (8.14.3/8.14.3/Debian-5+lenny1) with ESMTP id p6HC1iPw019722 for ; Sun, 17 Jul 2011 14:01:45 +0200 Original-Received: (qmail 29344 invoked by uid 89); 17 Jul 2011 12:01:42 -0000 Original-Received: from unknown (HELO ?192.168.20.101?) (hajtmar@88.103.230.14) by psi01 with ESMTPA; 17 Jul 2011 12:01:42 -0000 User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; cs; rv:1.9.1.8) Gecko/20100216 Thunderbird/3.0.2 X-Bayes-Prob: 0.0094 (Score 0, tokens from: @@RPTN) X-CanIt-Geo: ip=81.2.195.204; country=CZ; latitude=49.7500; longitude=15.5000; http://maps.google.com/maps?q=49.7500,15.5000&z=6 X-CanItPRO-Stream: uu:ntg-context@ntg.nl (inherits from uu:default, base:default) X-Canit-Stats-ID: 05F901IWX - 601db58bf1a0 - 20110717 X-Scanned-By: CanIt (www . roaringpenguin . com) on 194.171.167.220 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:70064 Archived-At: Hello all, For several hours trying to find solutions of problem. My minimal example (I mention it at the end of email) for clear reasons show, that : 7 is not number. 7 is number. 7is not number. 7is not number. In the first is argument '\value' negotiable to the value, in second it is not possible (but for clear reasons too). I would need to find from argument ie macro '\\value' in the LUA function its numerical value. Is there any function that would do that? I need something as a function of context (...), which would, however, its output is not located into ConTeXt, but its result get to back to a Lua function or into variable. It is something like the expansion of an existing ConTeXt macro to its value. Thanx Jaroslav Here is my minimal example: \startluacode function test(arg) if type(arg)=='number' then context(arg.." is number.\\par ") else context(arg.." is not number.\\par") end if type(tonumber(arg))=='number' then context(arg.." is number.\\par ") else context(arg.." is not number.\\par") end end \stopluacode \starttext \def\value{7} \ctxlua{test('\value');} \blank[big] \ctxlua{test('\\value');} \stoptext ___________________________________________________________________________________ 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 ___________________________________________________________________________________