lua-users home
lua-l archive

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


On 05/10/2016 09:10 AM, Thomas Jericke wrote:
On 05/10/2016 08:41 AM, Marc Balmer wrote:
This prevents a memory leak if lua_pushstring() raises an error, but I will end up with a number of rather small allocations that are only used for a short
period of time.
If they buffers are really that small, I would just use the stack.

char s[32];
snprintf(s, sizeof(s), "bumblebee");
lua_pushstring(L, s);



PS. I swear I typed this before I saw Sean's answer :-/