lua-users home
lua-l archive

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


Greetings. I am running lua as part of a project with many C++ header files
exposed to Lua via toLua 4.0a

This setup has been working extremely well, but I've just hit a strange bug
that I have not been able to track down. To initialize my lua state, I call
a long series of tolua_*_open functions. Once this list gets sufficiently
large, I get the error "error: attempt to index a nil value" in the very
first call to tolua_function() in about the 30th tolua_*_open() call.

The error happens during the following code snippet in tolua_function():

  lua_getglobal(L,parent);
  lua_pushstring(L,name);
  lua_pushcfunction(L,func);
  lua_settable(L,-3);

Clearly, the relevant global for parent is not being set, but I cannot see
why this is so. For my class (which is called PiGuiElementText, btw), I can
step through the corresponding call to
tolua_usertype(tolua_S,"PiGuiElementText"); which seems to work correctly.

I don't really know what to try next. Are there some limited resources in
toLua that I am running out of?

Any help is much appreciated...

Eric