From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.tex.context/59767 Path: news.gmane.org!not-for-mail From: Taco Hoekwater Newsgroups: gmane.comp.tex.context Subject: Re: Testing non-existent counter in Lua Date: Tue, 22 Jun 2010 07:55:31 +0200 Message-ID: <4C205053.1060803@elvenkind.com> References: <4C1FDC7A.3040604@gyza.cz> Reply-To: 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 1277186144 3807 80.91.229.12 (22 Jun 2010 05:55:44 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Tue, 22 Jun 2010 05:55:44 +0000 (UTC) To: hajtmar@gyza.cz, mailing list for ConTeXt users Original-X-From: ntg-context-bounces@ntg.nl Tue Jun 22 07:55:41 2010 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 1OQwSS-0002uA-Hp for gctc-ntg-context-518@m.gmane.org; Tue, 22 Jun 2010 07:55:40 +0200 Original-Received: from localhost (localhost [127.0.0.1]) by balder.ntg.nl (Postfix) with ESMTP id C9FA2C9C38; Tue, 22 Jun 2010 07:55:39 +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 nRBhhbF5uhwh; Tue, 22 Jun 2010 07:55:39 +0200 (CEST) Original-Received: from balder.ntg.nl (localhost [127.0.0.1]) by balder.ntg.nl (Postfix) with ESMTP id 1574CC9C22; Tue, 22 Jun 2010 07:55:37 +0200 (CEST) Original-Received: from localhost (localhost [127.0.0.1]) by balder.ntg.nl (Postfix) with ESMTP id E61DEC9C22 for ; Tue, 22 Jun 2010 07:55:34 +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 4YaIrz-LwsxO for ; Tue, 22 Jun 2010 07:55:32 +0200 (CEST) Original-Received: from smtp-vbr1.xs4all.nl (smtp-vbr1.xs4all.nl [194.109.24.21]) by balder.ntg.nl (Postfix) with ESMTP id DDC35C9BFB for ; Tue, 22 Jun 2010 07:55:32 +0200 (CEST) Original-Received: from [192.168.178.26] (boo.demon.nl [83.163.247.99]) (authenticated bits=0) by smtp-vbr1.xs4all.nl (8.13.8/8.13.8) with ESMTP id o5M5tVKb041476; Tue, 22 Jun 2010 07:55:32 +0200 (CEST) (envelope-from taco@elvenkind.com) User-Agent: Thunderbird 2.0.0.23 (X11/20090822) In-Reply-To: <4C1FDC7A.3040604@gyza.cz> X-Virus-Scanned: by XS4ALL Virus Scanner 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:59767 Archived-At: Jaroslav Hajtmar wrote: > Hi, all. > > How do I know (due Lua) that the counter has not been defined in ConTeXt > (through the command newcount)? > > I am trying testing : > > if tex.count.mycount == nil then... > > or > > if tex.count.mycount == 'error' then... > > then when counter isnt defined due \newcount\mycount, then test ending > with error message. > > When counter is defined due > \newcount\mycount, > \mycount=1 > > then test > if tex.count.mycount == 1 then... if token.command_name(token.create('mycount')) == 'assign_int' and tex.count.mycount == 1 then ... end Best wishes, Taco ___________________________________________________________________________________ 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 ___________________________________________________________________________________