lua-users home
lua-l archive

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


On Thu, 20 Sep 2001, Joshua Jensen wrote:

> > > Are you planning to move objects?
> >
> > No... Among other problems, GC can happen while C code keeps
> > pointers to strings inside Lua.
>
> I say this is too bad.  They should lua_ref() the object if they want it
> to keep it.  There is no guarantee the pointer in the C code will be
> good anyway, since Lua could have garbage collected it.

Maybe I was not clear. See following code:

  int f (lua_State *L) {
    const char *s = lua_tostring(L, 1);
    lua_call(...);  /* GC may occur here! */
    /* now, what about `s'?? */

-- Roberto