lua-users home
lua-l archive

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


Hi, list!

I have a C function, constructing some long string in luaL_Buffer. In
some rare cases this function may decide that it no longer want that
string, but want to report error to user instead (by returning nil and
error message).

The question is how to discard buffer in this case? Calling
luaL_pushresult() and popping it back seems to be unnecessary
expensive, and setting stack top at where it were before
luaL_buffinit() call seems to be too inpolite. What is the recommended
way to do it?

Thanks in advance,
Alexander.