lua-users home
lua-l archive

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


>>>>> "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.