[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: RE: Private data
- From: "Eric Ries" <eries@...>
- Date: Wed, 3 Oct 2001 18:01:25 -0700
We implemented this same thing almost exactly. It was quite useful to get
from a lua_State * to a pointer for our C++ wrapper class. I've heard that
Lua 4.1 has some macros to make this easier, but I have not really
investigated.
Eric
> Just add the following two functions:
> LUA_API void * lua_GetPrivateData(lua_State *L)
> {
> return L->pprivatedata;
> }
>
> LUA_API void * lua_SetPrivateData(lua_State *L, void * p)
> {
> L->pprivatedata = p;
> }
> And add
> void * pprivatedata;
> to the struct lua_State.
>