lua-users home
lua-l archive

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


> I have wrapped lua_State into a C++ class such that one can say
> 
> cLuaState ls;
> ls.Open(100);
> ls.PushNumber(3.14);
> ls.SetGlobal("PI");
> ls.DoString("print(PI)")
> ls.Close();
> etc.
> 
> However, I had to add a field to lua_State in order to be 
> able to get to my
> cLuaState from registered application functions written in 
> C++. Needless to
> say the function prototype had to change as well, as I had to 
> hide lua_State
> itself from the outside world completely. So my prototype 
> looks something
> like this

Could you not just derive your state from Luas state struct and downcast?
Have I missed the point?