From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.tex.context/83809 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 20:43:41 +0600 Message-ID: References: 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 1376491453 9887 80.91.229.3 (14 Aug 2013 14:44:13 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 14 Aug 2013 14:44:13 +0000 (UTC) To: mailing list for ConTeXt users Original-X-From: ntg-context-bounces@ntg.nl Wed Aug 14 16:44:17 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 1V9cJ6-0002H4-MU for gctc-ntg-context-518@m.gmane.org; Wed, 14 Aug 2013 16:44:16 +0200 Original-Received: from localhost (localhost [127.0.0.1]) by balder.ntg.nl (Postfix) with ESMTP id 26D7E10206; Wed, 14 Aug 2013 16:43:21 +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 B9zkPFU+VI6g; Wed, 14 Aug 2013 16:43:09 +0200 (CEST) Original-Received: from balder.ntg.nl (localhost [IPv6:::1]) by balder.ntg.nl (Postfix) with ESMTP id D774B101FE; Wed, 14 Aug 2013 16:43:09 +0200 (CEST) Original-Received: from localhost (localhost [127.0.0.1]) by balder.ntg.nl (Postfix) with ESMTP id 31406101FE for ; Wed, 14 Aug 2013 16:43:09 +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 uykxuyo-rBtW for ; Wed, 14 Aug 2013 16:42:49 +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 51595101FC for ; Wed, 14 Aug 2013 16:42:49 +0200 (CEST) Original-Received: from thesan.fiee.net (thesan.fiee.net [178.77.74.245]) by filter2-ams.mf.surf.net (8.14.3/8.14.3/Debian-9.4) with ESMTP id r7EEhhxx029901 for ; Wed, 14 Aug 2013 16:43:43 +0200 DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=default; d=fiee.net; b=CBiVG9lEdHOncdnLki69bloWJM2eV+vaznl9tH5K6rsU1ESo//ZIb09lAT/i5T8HRgi+hMe5oMaK+L1vIcGS9iUL802tkuruGoCDwULidkT+OVE4hWIM6er4zgUtmhZ8; 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 13944 invoked from network); 14 Aug 2013 16:43:43 +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 16:43:43 +0200 In-Reply-To: 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: 0QKcCHHwJ - 9204bb7d75cc - 20130814 (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:83809 Archived-At: Am 2013-08-14 um 20:15 schrieb Wolfgang Schuster : >> Current beta MkIV seems to have a bug in the Lua function io.lines: >> >> for myline in io.lines(myfile) do >> logs.report(myline) >> end >> >> "myfile" just contains one line with a number, without return/newline. >> If the number has more than one digit, I get single digits as "myeline". > > Do you have a minimal working example? Minimal working yes, but not minimal failing ;-) This works: io.output(io.open("myfile.txt","w")) io.write("123") io.close() for myline in io.lines("myfile.txt") do print(myline .. "\n") end But in my t-lilyfilter.tex where it reads the systems.count files of LilyPond (that contain only the number of note systems that resulted from the included LilyPond code), it fails: function thirddata.parselilypondfile(name) -- include all systems (note lines) -- name is like \LILYTEMP/mainfile-temp-lilypond-21.pdf logs.report("LILYPOND","name='" .. name .. "'") syco = 0 for ts in io.lines(string.gsub(name, '%.pdf$', '-systems.count')) do syco = ts*1 end for nr = 1, syco do logs.report("LILYPOND","including system no." .. nr) context("\\externalfigure[" .. string.gsub(name, '%.pdf$', '-' .. nr) .. "]") end end While I have a single-digit number of systems, it works, but the song of my failing case has 11 lines. I wouldn't complain if it wouldn't have worked before! Greetlings, Hraban ___________________________________________________________________________________ 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 ___________________________________________________________________________________