lua-users home
lua-l archive

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


On Sep 10, 2011, at 1:57 AM, waspoza wrote:

>  while true do
>    b = file:read(2^12)
>    if not b then break end
>    x:add(b)
>  end
> 
> Its uglier, but gives correct checksums.

If you prefer the for loop try something along these lines:

for b in function() return file:read( 2^12 ) end do
  x:add( b )
end


> Looks like io.lines can't read binary files. :(

As mentioned, try the "*L" option.

http://www.lua.org/work/doc/manual.html#pdf-file:read