lua-users home
lua-l archive

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

Dear subscribers,
I am having a problem with a lua script. The problem is as follows:
There is a C method called LwglMakeCurrent
and in the c++ file, i am having a registration as
lua_pushcfunction(L, LwglMakeCurrent);
lua_setglobal(L, "LwglMakeCurrent");
This works really well with most of the scripts. But, there is one script, which has about 13-14 global variables. In that script, when I call this method, it gives me an error attempt to call global (a nil value).
So, I guess my question is that is there a limit to the number of globals one can have in a lua script or in general the lua global environment?
Also, I must mention that I have at least about 300 C functions for which I have lua hooks, so that I can call these functions in a lua script
So, basically I do
lua_setglobal(L, fname), 300 times, with various different function names.
I am really feeling that the limit on the number of globals is coming into picture here, because the moment more globals are created within the script, the old globals that were pushed using
lua_pushcfunction and lua_setglobal are being returned with values = nil
Some one please respond with the possible opinions that you guys might have about this