[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: RE: LUA_USERSTATE
- From: Roberto Ierusalimschy <rieru@...>
- Date: Thu, 31 Jan 2002 09:26:25 -0600 (CST)
> > 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