[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: store pointer as a global
- From: Markus Ewald <Markus_Ewald@...>
- Date: Tue, 12 Dec 2000 20:48:54 +0100
Max Ischenko schrieb:
> I'm newbie to lua and I wonder how one can setglobal a C pointer
> from C code.
Try
nTag = lua_newtag(pLuaState);
lua_pushusertag(pLuaState, pMyPointer, nTag);
lua_setglobal(pLuaState, "VariableName");
where nTag is an integer, pLuaState the state you created using lua_open().
VariableName is the name of the global and pMyPointer the pointer you want
to store as userdata in it.
-Markus-