lua-users home
lua-l archive

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


On Mon, Aug 16, 2010 at 08:47, Roberto Ierusalimschy
<roberto@inf.puc-rio.br> wrote:
>> 1) The luaL_Buffer struct statically contains the temporary buffer
>> (size : LUAL_BUFFERSIZE), which may be a prb if you do not want to
>> consume the C stack too fast (on low end embedded system it matters)
>
> As a side note: LUAL_BUFFERSIZE may be any size. The default size is
> BUFSIZ for lack of a better default. Low end embedded systems should
> compile Lua with a more appropriate LUAL_BUFFERSIZE value.
>
> -- Roberto
>

I may not be understanding the problem correctly, but it looks like
lua_pushlstring does almost what you want. Couldn't there be just one
new function, lua_allocstring, that works like lua_pushlstring but
returns a char* rather than taking one, so you can then write into the
buffer it allocated?

-- 
Sent from my toaster.