lua-users home
lua-l archive

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

On Tue, Jan 11, 2011 at 2:18 AM, Josh Haberman <> wrote:
> Patrick Donnelly <batrick <at>> writes:
>> If you want to push a unknown string you either use luaL_Buffer or a
>> temporary userdata. Either way, you have to copy the string twice
>> (once into the buffer and again when Lua pushes the actual string).
>> There is no way around this. If you know the size of the string and it
>> is much greater than BUFSIZ, then you should use a temporary userdata
>> instead of luaL_Buffer (it is faster).
> I see that this is how things are in the status quo.  My question was
> whether the functions I suggested could be added to Lua's C API, in
> order to avoid the extra copy.  Unless I am missing something they
> should be easy to implement and could lead to significant efficiency
> improvements for programs that call file:read() with large files.

- Patrick Donnelly