lua-users home
lua-l archive

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


In a C  function that is called from Lua, I use the following idiom:

char *s;

...

s = lua_newuserdata(L, 128);

...

return;

After this function returns, what happens to the userdata?  Will it be garbage collected eventually or do I have to free() the pointer returned by lua_newuserdata()?  How does Lua "know" when the userdata is no longer used?