From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.tex.context/83815 Path: news.gmane.org!not-for-mail From: Henning Hraban Ramm Newsgroups: gmane.comp.tex.context Subject: Re: problem with lua io.lines Date: Wed, 14 Aug 2013 23:02:24 +0600 Message-ID: References: <520B9BA8.8080302@wxs.nl> Reply-To: mailing list for ConTeXt users NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 (Mac OS X Mail 6.5 \(1508\)) Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1376499774 11507 80.91.229.3 (14 Aug 2013 17:02:54 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 14 Aug 2013 17:02:54 +0000 (UTC) To: mailing list for ConTeXt users Original-X-From: ntg-context-bounces@ntg.nl Wed Aug 14 19:02:57 2013 Return-path: Envelope-to: gctc-ntg-context-518@m.gmane.org Original-Received: from balder.ntg.nl ([5.39.185.229]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1V9eTG-0007NS-Dm for gctc-ntg-context-518@m.gmane.org; Wed, 14 Aug 2013 19:02:54 +0200 Original-Received: from localhost (localhost [127.0.0.1]) by balder.ntg.nl (Postfix) with ESMTP id A9EFD101FD; Wed, 14 Aug 2013 19:01:58 +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 pqF02awGJbcZ; Wed, 14 Aug 2013 19:01:43 +0200 (CEST) Original-Received: from balder.ntg.nl (localhost [IPv6:::1]) by balder.ntg.nl (Postfix) with ESMTP id D401E10207; Wed, 14 Aug 2013 19:01:43 +0200 (CEST) Original-Received: from localhost (localhost [127.0.0.1]) by balder.ntg.nl (Postfix) with ESMTP id 22C3510207 for ; Wed, 14 Aug 2013 19:01:43 +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 xycHnvfzSet4 for ; Wed, 14 Aug 2013 19:01:32 +0200 (CEST) Original-Received: from filter4-ams.mf.surf.net (filter4-ams.mf.surf.net [192.87.102.72]) by balder.ntg.nl (Postfix) with ESMTP id 1813C101FD for ; Wed, 14 Aug 2013 19:01:32 +0200 (CEST) Original-Received: from thesan.fiee.net (thesan.fiee.net [178.77.74.245]) by filter4-ams.mf.surf.net (8.14.3/8.14.3/Debian-9.4) with ESMTP id r7EH2QLB001024 for ; Wed, 14 Aug 2013 19:02:26 +0200 DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=default; d=fiee.net; b=gUQEc6csCQPYYjxx/MHFbfrbekFBqFmU1/BIHBiAOmXUxiPaXyaXX1kGRp63BOp0xKhFtTdxS8ZQRfMTmCmGqcKgXF/K0lAtFFz2U3jWbG7gxnZU2EgZp4lhmP28QGvq; h=Received:Received:Content-Type:Mime-Version:Subject:From:In-Reply-To:Date:Content-Transfer-Encoding:Message-Id:References:To:X-Mailer; Original-Received: (qmail 15535 invoked from network); 14 Aug 2013 19:02:26 +0200 Original-Received: from unknown (HELO ?192.168.0.100?) (95.87.94.219) by thesan.fiee.net with ESMTPSA (AES128-SHA encrypted, authenticated); 14 Aug 2013 19:02:26 +0200 In-Reply-To: <520B9BA8.8080302@wxs.nl> X-Mailer: Apple Mail (2.1508) X-Bayes-Prob: 0.0001 (Score 0, tokens from: @@RPTN) X-CanIt-Geo: ip=178.77.74.245; country=DE; region=07; city=Host; latitude=51.6500; longitude=6.1833; http://maps.google.com/maps?q=51.6500,6.1833&z=6 X-CanItPRO-Stream: uu:ntg-context@ntg.nl (inherits from uu:default, base:default) X-Canit-Stats-ID: 01KcF2qP6 - 3e0f9efe306a - 20130814 (trained as not-spam) X-Scanned-By: CanIt (www . roaringpenguin . com) on 192.87.102.72 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:83815 Archived-At: Am 2013-08-14 um 21:00 schrieb Hans Hagen : >> for ts in io.lines(string.gsub(name, '%.pdf$', '-systems.count')) do >> syco = ts*1 >> end > > well, you probably were lucky before: string.gsub returns multiple values so io.lines get a second argument that limits the length of what gets returned Thank you, didn't know that! > local myfile = "myfile.txt" > > for myline in io.lines(myfile,2) do > logs.report("test",myline) > end > > so you need: > > io.lines((string.gsub(name, '%.pdf$', '-systems.count'))) > > or > > local name = string.gsub(name, '%.pdf$', '-systems.count') > > io.lines(name) Great, that works! > or maybe better: > > io.lines(file.replacesuffix(name,'-systems.count')) No, that doesn't work, because the dot stays, so I get foobar.-systems.count Greetlings, Hraban --- http://www.fiee.net/texnique/ http://wiki.contextgarden.net https://www.cacert.org (I'm an assurer) ___________________________________________________________________________________ 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 ___________________________________________________________________________________