lua-users home
lua-l archive

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


Tom N Harris <telliamed <at> whoopdedo.org> writes:

> function utf8_dofile(filename)
>    return assert(load(
>      function()
>        return string.gsub(
>               assert(io.open(filename)):read('*a'),
>               '^\239\187\191', '')
>      end,
>      filename
>    ))()
> end

Which will close the file at some unspecified time in the not-so-near future and
may lead to "Out of file handles", if called often with no GC betweeen.