[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: luaL_loadbuffer API cannot deal with shebang
- From: Roberto Ierusalimschy <roberto@...>
- Date: Wed, 22 May 2019 11:02:06 -0300
> Op Wo. 22 Mei 2019 om 15:41 het Coda Highland <chighland@gmail.com> geskryf:
>
> > On Wed, May 22, 2019 at 4:20 AM Francisco Olarte <folarte@peoplecall.com> wrote:
> >>
> >> Baozeng:
> >>
> >> On Wed, May 22, 2019 at 4:15 AM Baozeng <sploving1@gmail.com> wrote:
> >> > I have a simple Lua file, for example, hello.lua. The contents of the file starts with a shebang
> >>
> >> This is not a simple lua file, shebangs are not valid lua.
>
> They're not in the language, but the manual does document that the
> standalone interpreter skips such a line at the top of a file. So they
> are in practice standard Lua unless you are using your own
> incompatible custom interpreter.
As already pointed out, as it is not part of the language,
luaL_readbuffer (and loadstring in Lua) does not handle it.
Only loadfile does that. For strings, if needed, it is an easy
task (both in C and in Lua) to skip that line if needed.
-- Roberto