lua-users home
lua-l archive

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


Hi everyone,

It seems that the current idiom for loading libraries is to try avoiding touching global namespace. I would like to update the C++ bindings generator "dub" to reflect this.

My question regards the "luaopen" functions and their expected behavior.

Does this look OK for the "luaopen" of the entire "lui" library ?


extern "C" int luaopen_lui_core(lua_State *L) {
  lua_newtable(L);
  // <lib>
  luaL_register(L, NULL, lui_functions);
  // <lib>
  lua_pushstring(L, "Application");
  // <lib> "Application"
  luaopen_lui_Application(L);
  // <lib> "Application" <mt>
  lua_settable(L, -3);

  lua_pushstring(L, "Window");
  luaopen_lui_Window(L);
  lua_settable(L, -3);
  // <lib>
  return 1;
}                  


                                                               Gaspard