Add Module::registerInstance() and Module::getInstance().

Module::registerInstance() registers a module instance which can later
be retrieved using Module::getInstance().

registerInstance() is called in luax_register_module().

getInstance() expects the full name (as returned by Module::getName())
of the requested module.
This commit is contained in:
vrld
2012-08-05 16:03:37 +02:00
parent 6f1ff69b61
commit 1fd12e4596
3 changed files with 78 additions and 0 deletions
+3
View File
@@ -191,6 +191,9 @@ int luax_register_module(lua_State *L, const WrappedModule &m)
lua_setfield(L, -3, m.name); // love.graphics = table
lua_remove(L, -2); // love
// Register module instance
Module::registerInstance(m.module);
return 1;
}