lua-users home
lua-l archive

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


On Nov 29, 2011, at 9:21 AM, steve donovan wrote:

> [1] http://stevedonovan.github.com/Penlight/

Nicely done.

The extensive Penlight treatise mentions  "File-style I/O on Strings". Which is nice.

Would anyone have the reverse? String-style methods on Files?

E.g.:

local aFile = io.open( 'test.txt', 'rb' )

if aFile:find( 'foo', 1, true ) do
  ...
end

In other words, string methods [2] working in terms of a file object? :)

[1] http://stevedonovan.github.com/Penlight/#T18
[2] http://www.lua.org/manual/5.1/manual.html#5.4