lua-users home
lua-l archive

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


> 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?

You cannot have one function (lua_allocstring), because when you 'add' a string in the Lua VM it does a hash and keep it unique, etc. So if you want to add a string in the Lua VM you need to have its content.
That is why my idea of proposal was to dissociate the allocation part (prepstring) from the addition to the LuaVM part (push prepstring)