lua-users home
lua-l archive

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

On Thu, 2003-11-27 at 13:43, Peter Hill wrote:
> For Lua on a unix system, a file with the "x" flag set should start with a
> "#! /bin/lua" line (whether the file is Lua text or Lua byte code) followed
> by the actual file. The Lua interpreter will be piped the data after the
> "#!" line (which it won't see).

What fairy wonderland do you live in? the 'shebang' as it is often
referred to indicates to the kernel (or shell, or whatever feels like
parsing it) what program to run (and what args to give it) to get it to
parse the program in question...

dsilvers@kenton:~$ cat test

Anything else is wasted
dsilvers@kenton:~$ ./test Hello World
./test Hello World

Just to confirm, this is the case on Linux, solaris, hpux and every
other OS I have to hand to check this on.

It *is* up to the parser (Lua, shell, whatever) to parse out the shebang
so Lua does handle it in its parser.

However when it comes to compiled chunks, they're a big lump of binary
goo, and as such, what you have to do is persuade the kernel how to
handle them. Linux provides a system called 'binfmt_misc' which does
this sort of thing.

As for getting Lua to do clever things based on 'x' attributes etc, that
would break Lua's spirit of working entirely in the ANSI standard
wherever possible.

The way Lua does things now is (at least in my opinion) __right__ and
shouldn't be changed to make it rely on system knowledge at all.

(just my UKP 0.02)

Daniel Silverstone             
Hostmaster, Webmaster, and Chief Code Wibbler: Digital-Scurf Unlimited
GPG Public key available from       KeyId: 20687895