lua-users home
lua-l archive

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


Hi there,

I am currently investigating the use of a luaL_Buffer for storing data I read from some place until all is read an I am ready to return it as a string. Whilst basic usage is quite straightforward, I don't quite see what I am supposed to do when, during the buildup of a string with a luaL_Buffer, an error occurs and I am not interested in it's contents anymore and instead want to return something else (like nil + an error message). Can I safely abandon the buffer, or do I need to finalize it with luaL_pushresult() in any case and just pop the result off the stack? If the latter, can I somehow avoid the new string getting interned (for speed reasons)? This needs to work with lua 5.1-5.3, in case there are any differences in this regard.

Gunnar