[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: luaL_loadbuffer API cannot deal with shebang
- From: Andrew Gierth <andrew@...>
- Date: Thu, 23 May 2019 05:10:27 +0100
>>>>> "Baozeng" == Baozeng <sploving1@gmail.com> writes:
Baozeng> LuaL_dofile is ok. But sometimes users may use luaL_loadbuffer
Baozeng> to load a buffer that from a file.(There are many users, you
Baozeng> cannot decide what they do). So luaL_loadbuffer should have
Baozeng> the same behavior with luaL_loadfile.
But luaL_loadbuffer can't know whether the buffer actually came from a
file, and whether it was from the start of a file. So it makes more
sense for loadbuffer to accept only valid lua chunks, and require that
the caller handle any such details. (The other thing that dofile checks
that loadbuffer does not is whether the file starts with a BOM.)
--
Andrew.