lua-users home
lua-l archive

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

Luiz Henrique de Figueiredo <> writes:

> It *crashes*? The parser should give a polite message. I tested it
> and it gave
>  error: invalid control char;
>    last token read: `0x1B' at line 2 in file `./luac.out'

This is the error I got too.  I should have said reports an error
rather than crashes.  Sorry for the confusion.

> If we changed the code to what you suggested, then we'd have to skip the
> first line before deciding whether it's source or binary. 

Yes.  This is the solution suggested by Jay.  I think this is a very
good solution.  Please adopt his code.  Source code cannot contain the
0x1B byte, so there is no ambiguity.

> Not the end of the world, but right now I don't see that we'd gain
> much except making the code a little bit more complicated. Plus are
> you really suggesting that people edit binary files to add the #!
> line?

Yes.  It's easy.  See the Makefile in the original post on this
topic.  It contained a line like this to translate a byte code file
into a #! commented byte code file.

	echo '#! /usr/bin/env lua' | cat - $< > $@
	chmod +x $@