lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


Hi,

On Feb 20, 2014, at 22:11 , Craig Barnes wrote:

The next time you parse a text file which accidental has a \0 somewhere you
probably want this bug fix, too ;-) Especially after you spend hours to
figure out what is going on, ...

Or you could just use the 4 line alternative I already posted in this thread.

You mean:

   local file = assert(io.open(filename))
   local text = assert(file:read("*a"))
   for line in text:gmatch "([^\n]*)\n" do
       -- print(line)
   end

On my 486DX with 8MB RAM running Linux this get's out-of-memory killed reading a 10 MB example.
Likewise on my SparcStation 10.

-- 
 ExactCODE GmbH, Jaegerstr. 67, DE-10117 Berlin
 http://exactcode.com | http://exactscan.com | http://ocrkit.com | http://t2-project.org | http://rene.rebe.de