lua-users home
lua-l archive

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


Thanks for the replies. I don't quite understand how deep down this is implemented:

- It is mentioned in luaL_loadfilex but not in lua_load which seems to be the more basic function.
- It is mentioned in the Lua standalone but does it also apply when used as an extension? Or does thsi depend on what you use to load a file?

Robert


On 8 August 2016 at 00:11, Henrik Ilgen <henrik.ilgen@activevb.de> wrote:
Hey,

The shebang behavior is defined in section 7 of the manual:
http://www.lua.org/manual/5.3/manual.html#7

> To allow the use of Lua as a script interpreter in Unix systems, the
> standalone interpreter skips the first line of a chunk if it starts
> with #. Therefore, Lua scripts can be made into executable programs
> by using chmod +x and the #! form, as in

Regards,

Henrik

On 07.08.2016 23:39, Robert Virding wrote:
> Hi,
>
> I implement luerl, an Lua implementation running on top of erlang/OTP
> (https://github.com/rvirding/luerl), and try to keep it as compatible as
> I can with standard Lua, currently Lua 5.2.
>
> One thing I have noticed is that is skips leading "shebang" line, that
> is a line which starts with "#! / ...". This is useful for scripts and
> for loading script files into Lua. Where is this documented? Is it
> documented? I have tried to find it but haven't been successful.
>
> It also skips leading BOM as well.
>
> Thanks for any help,
>
> Robert
>