lua-users home
lua-l archive

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


> > So after using this a little and also in lea of the discussion on
> > libraries - wouldn't a functional interface be a better
> > solution? One that can accept multiple user contexts referenced
> > by id? [...]
> >
> > id = lua_setuserctx( L, (void*) p );
> >
> > p (mycontext*) = lua_getuserctx( L, id );
> >

What about this?

  lua_pushuserdata(L, p);
  id = lua_ref(L);
  ...
  lua_getref(L, id);
  p = (mycontext*)lua_touserdata(L, -1);


Too slow?

-- Roberto