lua-users home
lua-l archive

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

On 9/27/2010 3:20 AM, Duncan Cross wrote:

To be honest, it seems only fair to me, since Lua's standard script
file loader already supports ignoring the first line if it begins with
a shebang. This sets a precedent that it is appropriate for the loader
to ignore common, OS-specific pecularities at the beginning of a
script file.


A regrettable precedent, perhaps? Although it's an OS feature that is well documented and used on multiple platforms. In any case, I think the "correct" response to this problem is...

> load(func [, chunkname])
> Loads a chunk using function func to get its pieces.

function utf8_dofile(filename)
  return assert(load(
      return string.gsub(
             '^\239\187\191', '')

Or something like that.

- tom