lua-users home
lua-l archive

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


	Hi there, Markus Ewald!
	On Tuesday, 12 of December you wrote:

> 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.

Thank you for your explanaition.

-- 
Best regards, Maxim F. Ischenko.